###############################################################################
# File Name  : Global.Makefile.target.make.3                                  #
# Description: Global makefile                                                #
#              This makefile implements the common features of each project.  #
#              It is included by the project local file "Makefile" which      #
#              contains the project settings.                                 #
#                                                                             #
#              This file MUST NOT BE CHANGED on project integration           #
#                                                                             #
# Application: GNU Make version 3.79.1, by Richard Stallman and Roland McGrath#
#              Built for Windows32                                            #
#                                                                             #
#-----------------------------------------------------------------------------#
#               C O P Y R I G H T                                             #
#-----------------------------------------------------------------------------#
# Copyright (c) 2002-2009 by Vector Informatik GmbH.  All rights reserved.    #
#                                                                             #
#-----------------------------------------------------------------------------#
#               A U T H O R   I D E N T I T Y                                 #
#-----------------------------------------------------------------------------#
# Initials     Name                      Company                              #
# --------     ---------------------     -------------------------------------#
# Uf           Ulrich Frank              Vector Informatik GmbH               #
# Get          Matthias Gette            Vector Informatik GmbH               #
# Arh          Andre Rauh                Vector Informatik GmbH               #
# Fr           Markus Feninger           Vector Informatik GmbH               #
# Jmk          Jochen Mack               Vector Informatik GmbH               #
# Mas          Markus Schwarz            Vector Informatik GmbH               #
# Lo           Uwe van de Loo            Vector Informatik GmbH               #
# Ms           Gunnar Meiss              Vector Informatik GmbH               #
# Msr          Martin Schlodder          Vector Informatik GmbH               #
# Abc          Alexander Becker          Vector Informatik GmbH               #
# Kba          Katharina Benkert         Vector Informatik GmbH               #
#-----------------------------------------------------------------------------#
#               R E V I S I O N   H I S T O R Y                               #
#-----------------------------------------------------------------------------#
# Date         Version  Sign Description                                      #
# ----------   -------  ---- -------------------------------------------------#
# 2002/07/29   3.00     Uf   Adapted Global.Makefile.target.make.1            #
# 2002/08/16   3.00.01  Uf   copy, move, rm, rrm force flag added             #
# 2002/08/16   3.01     Uf   Lint File can now be set manually (PCLINT_FILE)  #
# 2002/10/07   3.02     Uf   Removed different COMPILE_RULE for different     #
#                            error output methods                             #
# 2002/10/18   3.03     Uf   BRS is now optional                              #
# 2002/10/21   3.04     Uf   Spaces in paths (includes) are now allowed       #
# 2002/10/31   3.05     Uf   OSEKOS support added                             #
# 2002/11/21   3.06     Uf   Performance update, pclint bugfix                #
# 2003/01/23            Uf   Rule to generate VisualC Project File            #
# 2003/01/23   3.07     Uf   Rule to generate CodeWright Project File         #
# 2003/02/07   3.07.01  Uf   Added List and Mapfile entry in dsp file         #
# 2003/02/12   3.07.02  Uf   Added List and Mapfile entry in pjt file         #
#                            Added Rule to generate psp file                  #
# 2003/02/19   3.07.03  Uf   Fixed Bug in CANoe osCan generation rule.        #
#                            REDIRECT_ERROR now "tee's" errors to file and    #
#                            stdout.                                          #
#                            Pclint generation rule for single file can now   #
#                            handle cpp files                                 #
# 2003/02/21   3.07.04  Uf   Added Visual Studio project file generation      #
# 2003/02/25   3.07.05  Uf   REDIRECT_ERROR recovered from old version as it  #
#                            inhibits error detection                         #
# 2003/02/27   3.07.06  Uf   Error in Codewright project file generation fixed#
#                            (only *.err files were shown)                    #
#                            Added function to get index from list element    #
#                            Changed name for CodeWright/Visual Studio project#
#                            file generation rule (codewright/visual)         #
#                            Added platform specific help functionality       #
# 2003/03/03   3.07.07  Uf   Bugfix of INCFILE_LIST variable (lines without a #
#                            \ at the end are not removed any longer          #
#                            Bugfix of visual target: subst in group sources  #
#                            Bugfix in version target: $(V_CFG_LOC) instead   #
#                            of data directory                                #
# 2003/03/05   3.07.08  Uf   Added components to MODULE_LIST                  #
#                            Enhanced error reporting if v_cfg is missing     #
# 2003/03/13   3.07.09  Uf   Removed warning if ADDITIONAL_OBJECTS are defined#
# 2003/03/18   3.07.10  Uf   Bugfix of INCFILE_LIST variable                  #
#                            (obj\xxx.$(OBJ_SUFFIX): \ )                      #
# 2003/03/21   3.07.11  Uf   Added SipCheck Support                           #
#                            Added GENDATA_DIR Support                        #
# 2003/03/26   3.07.12  Uf   MODULE_LIST is now extensible                    #
# 2003/03/21   3.07.13  Uf   Bugfix for CodeWright/Visual project file        #
#                            generation with large projects (INCFILE_LIST     #
#                            is limited in size)                              #
#                            BRS only included in Visual project when used    #
# 2003/04/03   3.07.14  Uf   Bugfix of INCFILE_LIST variable                  #
#                            (obj\xxx.$(OBJ_SUFFIX): source.c\n               #
#                            Print out C/LDFLAGS in version rule              #
#                            Project Generation failure on use of             #
#                            ADDITIONAL_OBJECTS                               #
# 2003/04/07   3.07.15  Uf   Generate Brs tool version info file              #
#                            Changed to Cygwin tools                          #
#                            $(RM) doesn't ignore write protection any more   #
#                            GCCINCLUDES is no longer case sensitive          #
#                            OSEKOS support added to project generation       #
#                            OSEKOS generation directory no long depends on   #
#                            ROOT directory (GENDATA_OS_DIR added)            #
# 2003/04/22   3.07.16  Uf   Doxygen support added                            #
#                            Bugfix: blanks in include path list              #
#                            Renamed Common to _Common                        #
# 2003/04/24   3.07.17  Uf   BrsVInfo.h generation bugfix                     #
#                            Added XX_ENV varibles for environment settings   #
#                            Added dependencies for BrsVInfo.h                #
#                            Added additional output for BrsVInfo.h           #
# 2003/05/04   3.07.18  Uf   Deletion of BrsVInfo.h before build              #
#                            Added additional help text                       #
# 2003/05/04   3.07.19  Uf   Preprocess target added                          #
#                            _toUpper, _toLower, _separatedList function added#
#                            rebuild target bugfix                            #
# 2003/05/15   3.08.00  Uf   C_COMP_ define analysis added                    #
#                            Version target now checks include dirs           #
#                            ASSEMBLE rule added                              #
# 2003/06/02   3.08.01  Uf   rebuild, depend target updated                   #
#                            Codewright project file generation bugfix        #
#                            filter same file with / or \ out of OBJECTS      #
# 2003/06/04   3.08.02  Uf   ifndef brackets removed                          #
# 2003/06/05   3.08.03  Uf   check current working directory                  #
#                            double depency generation fixed                  #
#                            brsvinfo.h now deleted on distclean              #
#                            [_]to(Upper/Lower) now can handle \              #
# 2003/07/02   3.08.04  Uf   BrsVInfo.h is only generated if BRS_USED=1       #
#                            version target fixed (comment after version)     #
#                            Strip MAKESUPPORT_DIR due to potential blanks in #
#                            m.bat                                            #
# 2003/08/01   3.08.05  Uf   Visual Slick Edit project file generation added  #
# 2003/09/10   3.08.06  Uf   Added "lint single files" to online help         #
#                            Version scan now handles version string correctly#
#                            Fixed version scan overflow                      #
# 2003/10/08   3.08.07  Uf   Encapsulate pclint defines in quotes, blanks must#
#                            be quoted by backslash                           #
# 2003/10/09   3.08.08  Uf   Pclint fix                                       #
# 2003/10/23   3.08.09  Uf   CANDESC_BASIC supported                          #
# 2003/10/28   3.08.10  Uf   GENDATA_DIR now support DOS path separator       #
#                            CPU type check ignores case                      #
#                            Version text in comments fix                     #
# 2004/02/09   3.08.11  Uf   Resource information generation (by Kai Scharm)  #
#                            PCLint filename for slick edit WS fixed          #
# 2004/03/02   3.08.12  Uf   Lint/Preprocess issue fixed (same filesuffix)    #
# 2004/03/04   3.08.13  Uf   Error output can now be redirected to stdout     #
#                            Set ERR_TO_STDOUT to any value to put red. on    #
#                            Fixed INCFILE_LIST, codewright and slick target  #
# 2004/03/10   3.08.14  Uf   Moved BRS_DATA to Makefile.project.part.defines  #
# 2004/03/25   3.08.15  Uf   Preprocess rule now allowes %.c and %.C files    #
# 2004/04/05   3.08.16  Uf   Added missing brace in _separatedList command    #
# 2004/04/13   3.08.17  Uf   Codewright project file fixed (*.$(ASM_SUFFIX))  #
#                            Preprocess rule fixed (case insensitive)         #
#                            $(MAKEDEP_OFF) enironment variable evaluation    #
# 2004/04/23   3.08.18  Get  FBL support added                                #
#                            Dependencies for Makefile.config added           #
# 2004/07/01   3.08.19  Uf   Vector Standard Library support added            #
# 2004/07/12   3.08.20  Uf   QAC support added                                #
#                            Some outputs changed                             #
#                            New component added                              #
# 2004/09/06   3.08.21  Uf   NMH compnenent added                             #
# 2004/09/16   3.08.22  Uf   Derivative output added to version targer        #
#                            Multiple output of version info removed          #
# 2004/09/23   3.08.23  Uf   Upgraded to QAC 6.0, MAKE version output changed #
# 2004/10/07   3.08.24  Uf   DPM compnenent added                             #
#                            Version scan modified                            #
#                            QAC warnings if platform is not supported        #
#                            Error if Makefile.config vars are not adjusted   #
# 2004/10/27   3.09.00  Uf   Generation of PCLint.lnt file added              #
#                            Additional Tool support for build process        #
#                            Splitted flags for build process                 #
#                            BrsVInfo.h generation extended                   #
#                            Additional Tools supported (e.g. needed if more  #
#                            one compiler is used (HC12/Xgate)                #
#                            Added new components                             #
#                            Added Visual Studio .NET project file generation #
#                            Strip separatedList/_separatedList               #
#                            Doxygen support adjusted/upgraded to 1.3.9.1     #
#                            Usage of vector types in BrsVInfo.h              #
#                            Encapsulation of Flagstrings in BrsVInfo.h       #
#                            Delete files only if writeable                   #
# 2005/02/07   3.09.01  Uf   Doxygen configuration changed                    #
# 2005/03/14   3.09.02  Uf   Distclean removes $(GENDATA_OS_DIR)              #
# 2005/03/29   3.09.03  Mas  QAC non-suppression of headers                   #
#                       Uf   Added _DATA files to qac project                 #
# 2005/05/20   3.09.04  Uf   Added new clearquest names for components        #
# 2005/05/20   3.09.05  Mas  Updated rules for all_MISRA_rules_QAC60.p_s      #
# 2005/07/12   3.09.06  Uf   Updated rules for all_MISRA_rules_QAC60.p_s      #
# 2005/07/21   3.09.07  Uf   Fixed pclint rule: multiple equivalent files     #
# 2005/07/22   3.09.08  Uf   USE_V_CFG switch added, minor fixes              #
# 2005/08/01   3.09.09  Uf   Fixed visual(7) project generation (usage with   #
#                            old style project name BRS instead of ZBRS)      #
# 2005/08/09   3.09.10  Uf   Added new component                              #
#                            Makefile.project.part.defines Version check      #
# 2005/08/10   3.09.11  Uf   $(ROOT)\fbldrv added to common includes          #
# 2005/08/12   3.09.12  Uf   Added <COMPONENT>_COMMON sources                 #
# 2005/08/16   3.09.13  Uf   Added new component                              #
# 2005/09/01   3.09.14  Uf   Updated to new MPPD version                      #
#                            Added release sheet target                       #
# 2005/10/11   3.09.15  Uf   Added AsrDcm and CclCom components               #
#                            V_CFG_DETECTED moved                             #
# 2005/11/11   3.09.16  Uf   Added releasesheet help                          #
#                            Added GW_ADMIN_DC, GW_GATEWAY                    #
#                       Om   Added AUTOSAR components                         #
# 2005/11/17   3.10.00  Uf   Added librarian support                          #
#                            New resource scanner                             #
#                            Added GENy version scan extension                #
# 2005/11/17   3.10.01  Uf   Fixed version retrieval                          #
# 2005/12/19   3.10.02  Arh  releasesheet and version target update           #
#                            XX_ENV_U overrideable                            #
# 2005/12/22   3.10.03  Uf   Added qac message 3892 to message personality    #
#                            Added new components                             #
# 2006/01/30   3.10.04  Uf   Fixed librarian support                          #
# 2006/02/20   3.10.05  Uf   Added NM_ASRNMCANWRAPPEREXT                      #
# 2006/02/24   3.10.06  Uf   Renamed COMMON_VSTDLIB to VSTDLIB                #
# 2006/03/09   3.10.07  Arh  Added support for blanks in files and path       #
#                            used for version scan.                           #
#                            Resource scanner improvements.                   #
#                            Releasesheet generation now based on Version.info#
#                       Uf   Changed GENY_DIR to GENTOOL_DIR                  #
#                            Introduced GENTOOL_TYPE                          #
#                            Removed GENY component dll version scan          #
# 2006/03/20   3.10.08  Arh  Fixed and extended resource scanner              #
# 2006/06/27   3.10.09  Uf   Added GW_ROUTE                                   #
# 2006/07/10   3.10.10  Uf   Added NM_STMGRINDOSEK, renamed releasesheet      #
#                            Get message personality file from intranet       #
# 2006/07/18   3.10.11  Uf   Added NM_HONDA                                   #
#                            Added DIAG_CANDESCGGDAEXT_GM                     #
# 2006/08/02   3.10.12  Uf   Copy of resource info fixed                      #
# 2006/09/13   3.10.13  Arh  Workaround for Excel '#NAME?' in Resource.xls    #
#                            and fixed bug during creation of INCFILE_LIST.   #
# 2006/10/16   3.10.14  Fr   Renamed NM_HONDA to NM_BCAN_HONDA                #
# 2006/10/27   3.10.15  Uf   Delete lib dir on distclean                      #
#                            surround _used checks by strip                   #
#                            COMPILER_INC not mandatory any more              #
#                            USER_LINKER_COMMAND_FILE added                   #
#                            added IF_ASRIFLIN, IL_ASRCOM                     #
# 2006/11/13   3.10.16  Fr   Additional inc dir for FBL added (FBLCAN_INC)    #
# 2006/12/18   3.10.17  Arh  Fixed XML entity translation in resource script  #
# 2007/01/26   3.10.18  Mas  Added several new components                     #
# 2007/02/15   3.10.19  Jmk  Added several new components                     #
# 2007/02/15   3.10.20  Get  Makefile.config dependency added                 #
# 2007/03/05   3.10.21  Mas  Fixed issue with INCFILE_LIST                    #
# 2007/03/13   3.10.22  Mas  Fixed issue with MAKE_DEPEND_RULE                #
# 2007/04/30   3.10.23  Uf   Fixed release GENy revision number scan          #
# 2007/05/23   3.10.24  Uf   Fixed list of used source files (header and src) #
#                       Aba  Additional executable (size-command) added       #
#                            Autosar-make process supported                   #
#                            Automatic word wrapping of gcc-preprocessor      #
#                            during dependency-generation with SED fixed      #
# 2007/07/04   3.10.24  Aba  Added Support for Visual Studio Version 8        #
#                            Project- and Solutionfile generation (visual8)   #
#                            Added MODULE_DATA_LST to Visual Studio generation#
# 2007/08/21   3.10.25  Fmi  Fixed support for Visual Studio Version 8        #
# 2007/08/21   3.10.26  Uf   Fixed Visual Studio                              #
# 2007/08/21   3.10.27  Lo   Fixed QAC 7 support                              #
# 2007/12/04            Ms   Added $(PROJECT_NAME).ilk to the clean process   #
#                       Ms   Fixed Version Scan                               #
#                       Ms   Fixed Generic Pclint rules                       #
#                       Ms   Fixed Pclint Global Wrap Up                      #
#                       Ms   Updated MODULE_LIST_ASR                          #
#                       Ms   Added SKIP_ASR_MAKEFILES                         #
# 2008/01/09   3.10.28  Lo   Support for ASR mak files                        #
#                       Jk   Support for Ccl_AsrSmCan added                   #
#                       Msr  Support for (Tp)?J1939_Asr(Base|Bam|Cmdt) added  #
# 2008/02/05   3.10.29  mas  added Ccl_AsrSmLin                               #
#                       mas  changed TpFr_AsrTpFr to Tp_AsrTpFr               #
#                       Lo   added brs_asr.oil                                #
# 2008/03/19            Ms   Upgraded Doxygen to version 1.5.5                #
# 2008/04/16   3.10.30  Lo   Build lib issue solved                           #
#                            Build libs without a specified object            #
#                            Added SysService_Issm_Volvo_ab                   #
# 2008/04/29   3.11.00  Lo   QuickBuild                                       #
#                            Full Librarysupport for ASR                      #
#                            compSource found multiple results                #
#                            in visual projects MSN names are used for ASR    #
#                            add own / suppress includes for QAC              #
# 2008/07/01   3.11.01  Lo   BrsVInfo.h in ASR Projects                       #
#                            ERR_TO_STDOUT must be equal 1 to be enabled      #
#                            added Tp_Mcan_Renault                            #
#                            gendataos dir stays after m distclean            #
#                            manually generation of os with m os              #
#                            libs in ADDITIONAL_OBJECTS switchs off c files   #
#                            libs in ADDITIONAL_OBJECTS are copied autom.     #
# 2008/07/30   3.11.02  Lo   added SmFr                                       #
#                       Fr   Fixed resource scanner                           #
# 2008/09/02   3.11.03  Lo   switch off of c files improved                   #
#                       Lo   QAC forgot warnings in generated files           #
# 2008/10/06   3.11.04  Wnk  Introduced new FlexRay-TP Tp_Iso10681            #
#                            Set RELEASE_VERSION to 4 as it was 0             #
#                       Lo   Ignore BRS_DATA if not used in for qac           #
# 2008/11/10   3.11.05  Lo   Added J1939                                      #
# 2009/01/20   3.11.06  Lo   QAC not working with whitespace in path          #
#                       Lo   rebuild not working with whitespace in path      #
#                       Lo   Added support for Visual2008                     #
#                       Lo   Added CFLAGS and CFILTER to DeliveryDescription  #
#                       Lo   new path for resource result file and check      #
#                       Get  Added BAC 2.1 components                         #
#                       Lo   Qac input.txt each file with one line            #
# 2009/04/09   3.11.07  Lo   Added CP_XCPONFRASR                              #
#                       Fmi  manually generation of os with m os fixed        #
#                       Ms   Added IL_ASRIPDUM                                #
# 2009/04/21   3.11.08  Lo   Adaption for new delivery structure              #
# 2009/04/24   3.11.09  Ard  Rename J1939ASRBASE to TPJ1939ASRBASE            #
# 2009/05/04   3.11.10  Lo   Adapt toolpath for new delivery structure        #
#                       Lo   Remove target releasesheet                       #
# 2009/05/05   3.11.11  Lo   Add Nm_PwrTrain_Chery                            #
# 2009/05/15   3.11.12  Lo   new QAC path                                     #
#                       Lo   hidden whitespace in GenTool Path removed        #
#                       Lo   new delivery structure supports asm files        #
# 2009/05/29   3.11.13  Lo   includes with autosar fixed                      #
#                       Lo   support explicit transceivers                    #
#                       Lo   new delivery structure support libraries         #
# 2009/08/04   3.11.14  Lo   m distclean do not delete binary and map file    #
#                       agh  added NM_DIROSEKEXT_VAG                          #
#                       Lo   m resource copy config to repository             #
#                       Lo   bugfix of SOURCES_IN_LIBS                        #
#                       Lo   support of asm files in GENERATED_SOURCE_FILES   #
#                       Lo   remove TPJ1939_ASRCMDT and TPJ1939_ASRBAM        #
# 2009/09/04   3.11.15  Lo   filter sources in libs for visual project        #
#                       Lo   added DRVETH                                     #
#                       Lo   added Tp_TcpIp,If_AsrIfEth                       #
#                       Lo   added IL_ASRIPDUMISBMWSUB,                       #
#                            SYSSERVICE_CRYPTOEBBMWSUB,TP_ASRTPLIN            #
#                            TPJ1939_FP,TPJ1939_ETP,TPJ1939_BASEEXT,          #
#                            NMJ1939_DYNAMIC                                  #
#                       Lo   improve copylibs                                 #
# 2009/09/18   3.11.16  Lo   added DrvFls_XXadbus01EAsr,DrvFls_XXspi01EAsr    #
#                            added DrvFls_Mcs12xFslftm01ExtVx                 #
#                            added DrvTrans_Tja1040CandioAsr                  #
#                            new library handling, add SysService_EepM        #
# 2010/01/07   3.11.18  Lo   added Nm_CbdNmIf,Il_Vector_Gm,Ccl_AsrSmEth       #
#                            If_AsrIfSoAd,DrvTrans_CanoeemuEthAsr             #
#                            mask resource target dir                         #
#                            replace xslt transformer                         #
#                            add Cp_AsrXcp                                    #
#                            filter version info files                        #
#                            no CFLAGS filter for appl in deliverydescr.      #
# 2010/02/23   3.11.19  Lo   added SysService_AsrCal,SysService_CplCvSub      #
#                            add DIAG_ASRDEM_xxx and CCL_xxx                  #
# 2010/02/26   3.11.20  Lo   added Tp_Http,SysService_Dns,SysService_Json,    #
#                            SysService_Tls,SysService_SswRcs_Daimler         #
# 2010/02/26   3.11.21  Lo   bugfix SYSSERVICE_DNS_Path                       #
# 2010/03/15   3.11.22  Lo   rename DIAG_CDC_BMW to DIAG_CDCEBBMWSUB          #
#                            rename DIAG_DARH_BMW to DIAG_DARHVECTORBMWSUB    #
#                            rename DIAG_DIAG_BMW to DIAG_DIAGEBBMWSUB        #
#                            rename CCL_VSM_BMW to CCL_VSMEBBMWSUB            #
#                            rename SYSSERVICE_CODING_BMW                     #
#                            to SYSSERVICE_CODINGEBBMWSUB                     #
#                            rename SYSSERVICE_FREETIMER_BMW                  #
#                            to SYSSERVICE_FREETIMEREBBMWSUB                  #
#                            rename SYSSERVICE_PIA_BMW                        #
#                            to SYSSERVICE_PIAISBMWSUB                        #
#                            rename SYSSERVICE_SYSTIME_BMW                    #
#                            to SYSSERVICE_SYSTIMEEBBMWSUB                    #
#                            add CCL_ASRCOMMEBBMWSUB                          #
# 2010/03/16   3.11.23  Lo   add Common_SipVersionCheck                       #
#                            add Diag_AsrDcmEbBmwSub,Diag_AsrDemEbBmwSub      #
# 2010/03/17   3.11.24  Lo   remove GENTOOL_TYPE                              #
# 2010/03/31   3.11.25  Lo   add GENTOOL_DIR check and ASR variables          #
# 2010/04/09   3.11.26  Lo   remove SysService_Fim_Bmw                        #
#                            add IfFees and IfWds                             #
# 2010/04/22   3.11.27  Lo   Add Diag_x components                            #
# 2010/04/27   3.11.28  Lo   Add DrvTrans_Tle62512G                           #
# 2010/04/28   3.11.29  Lo   remove LinNm                                     #
# 2010/05/11   3.11.30  Lo   add Il_AsrIpduMEbBmwSub                          #
# 2010/05/17   3.11.31  Lo   bugfix Diag_Dc                                   #
# 2010/06/07   3.11.33  Lo   add ignore list for dependency generation        #
# 2010/06/16   3.11.34  Lo   add ant script                                   #
# 2010/06/30   3.11.35  Lo   add Gw_Route* components                         #
# 2010/07/14   3.11.36  Lo   change fileset to filelist in build.xml          #
#                            add preprocessor in build.xml                    #
# 2010/07/21   3.11.37  Lo   add Diag_Elapcu                                  #
# 2010/08/23   3.11.38  Lo   add DrvEed,If_AsrIfFrDrvTrans                    #
# 2010/10/08   3.11.39  Lo   add DrvEep_XAt25128EAsr, Tp_AsrTpFrEbBmwSub,     #
#                            Diag_AsrDem_Fiat,DrvFls_XXStubAsr,Tp_20_Vag,     #
#                            Diag_AsrDcmI2SAudiSub,Diag_AsrDemI2SAudiSub,     #
#                            Ccl_Fiat,DrvWd_XXStubAsr,DrvEep_XXStubAsr        #
#                            remove I2S_TP_ISO15765                           #
# 2010/11/02   3.11.40  Lo   add DrvWd_XTle4278gEAsr,SysService_SswScc        #
#                            SysService_IpBase,SysService_Crypto              #
#                            keep xml in GENDATA dir                          #
#                            change deliverydescription target dir            #
# 2010/11/09   3.11.41  Lo   add DrvTrans_E52013CanspiAsr,Nm_AsrNmClassB_Fiat,#
#                            Nm_AsrNmDirOsek,SysService_Exi,                  #
#                            If_AsrIfFeeV85xNec05Sub,DrvTrans_Int6400EthAsr   #
# 2010/11/30   3.11.42  Lo   deliverydescription target dir for old structure #
#                            add SysService_AsrBswM,If_AsrIfEaBasic,          #
#                            If_VxIfMost,                                     #
#                            correct GW /sig/msg/tp                           #
# 2011/03/17   3.11.43  Lo   add DrvIcu_Tms570Tinhet01ExtVx,                  #
#                            SysService_XmlEngine,Ccl_Asr4SmCan               #
# 2011/04/26   3.11.44  Lo   add SysService_AsrRamTst,J1939_Router            #
# 2011/08/10   3.11.45  Lo   add Tp_IpV4,Tp_IpV6,Diag_AsrDcm_Toyota,          #
#                            DrvCrc_Tms570Timcrc01Asr                         #
#                            remove TpJ1939_Base,TpJ1939_BaseExt              #
#                            clean not working for many files fixed           #
# 2011/08/11   3.11.46  Lo   new deliverydescription                          #
# 2011/08/15   3.11.47  Lo   silent clean                                     #
# 2011/08/31   3.11.48  Lo   update help                                      #
#                            update cygwin1.dll                               #
# 2011/09/01   3.11.49  Lo   bugfix for new cygwin1.dll                       #
# 2011/09/16   3.11.50  Lo   bugfix for new cygwin1.dll resource scanner      #
# 2011/09/28   3.11.51  Lo   bugfix for version.info. (ignore case in 'true') #
# 2011/10/05   3.11.52  Lo   add DrvTrans_Ar7000EthAsr,DrvTrans_Dp83848EthAsr #
# 2012/01/11   3.11.53  Lo   change Misra settings                            #
#                            improve interaction with new cygwin1.dll         #
#                            new deliverydescription filename                 #
# 2012/01/14   3.11.54  Lo   change deliverydescription target folder         #
# 2012/02/21   3.11.55  Lo   add new components                               #
#                            support LIBRARIES_LINK_ONLY and OBJECTS_LINK_ONLY#
# 2012/03/12   3.11.56  Lo   add new components                               #
# 2012/06/09   3.11.57  Lo   add new components                               #
#                       kba  add visual 10 support                            #
# 2012/07/16   3.11.58  Ard  introduce MODULE_LIST_PROJECT                    #
# 2012/09/05   3.11.59  lo   add new components                               #
# 2012/10/11   3.11.60  lo   extend error message                             #
# 2012/10/11   3.11.60  ms   added Release Configuration to sln file          #
# 2012/11/21   3.11.61  agh  change for SWCP support (just copyed from trunk) #
# 2013/03-05   3.11.62  ebl  fix additional MSVC rules in build.xml generator #
# 2013/03-14   3.11.63  ebl  fix QAC project creator, cracking command line   #
# 2013/04/11   3.11.66  abc  corrected / improved visual10 target             #
# 2013/04/16   3.11.67  abc  further improvements in visual10 target          #
# 2013/04/19   3.11.68  ebl  MISRA project setup updated                      #
# 2013/05/06   3.11.69  ebl  Added Rtm	                                      #
# 2013/05/07   3.11.70  ebl  MISRA project setup updated                      #
# 2013/09/05   3.11.71  ebl  Switch for total disabling of BrsVInfo.h creation# 
#              3.11.72  ebl  Added DrvTrans_Bcm89810EthAsr                    #
# 2013/09/27   3.11.73  abc  further improvements in visual10 target          #
# 2013/10/28   3.11.74  ebl  Added SomeIp, Sd, DoIP                           #
# 2013/12/02   3.11.75  ebl  Added TpAv                                       #
# 2013/12/03   3.11.76  ebl  MISRA .prj generator fixes by viswas             #
#                            Replaced selfcall path tricks with just $(MAKE)  #
###############################################################################

##############################################################################
# Check if versions fit together
##############################################################################

MODULE_VERSION = 3
SUB_VERSION_HISTORY = 0 1 2 3 4 5 6 7 8 9 10 11
NEWEST_SUB_VERSION = 11
RELEASE_VERSION    = 74

MPPD_VERSION_HISTORY = 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

ifneq ($(SUB_VERSION), $(findstring $(SUB_VERSION),$(SUB_VERSION_HISTORY)))
    $(error MakeSupport-Subversion <$(SUB_VERSION)> is not supported)
else
    ifneq ($(SUB_VERSION), $(NEWEST_SUB_VERSION))
        $(warning Warning: <Makefile> is not up to date.)
        $(warning Used subversion is <$(SUB_VERSION)>. \
                  Newest subversion is <$(NEWEST_SUB_VERSION)>.)
    endif
endif

ifeq ($(MPPD_VERSION),)
    ifeq ($(SUB_VERSION),10)
        $(error Error: Wrong Makefile.project.part.defines Version! Please update to the current template.)
    else
        $(warning Warning: Unknown Makefile.project.part.defines Version! Please update to current template.)
    endif
else
    ifneq ($(MPPD_VERSION), $(findstring $(MPPD_VERSION),$(MPPD_VERSION_HISTORY)))
        $(error Makefile.project.part.defines Version <$(MPPD_VERSION)> is not supported!)
    else
        ifeq ($(findstring $(SUB_VERSION),0 1 2 3 4 5 6 7 8 9),)
            ifeq ($(MPPD_VERSION), $(findstring $(MPPD_VERSION),19 20 21 22))
                $(warning Warning: Makefile.project.part.defines version $(MPPD_VERSION) does not support library target! Please update to the current template.)
            else
                MPPD_SUPPORT_LIBS = 1
            endif
        endif
    endif
endif

ifneq ($(MODULE_SOURCE_LIST_OLD),)
    $(warning Warning: Usage of old-style component names in Makefile.project.part.defines! Please update to current template.)
endif

##############################################################################
# Tool settings
##############################################################################

#-----------------------------------------------------------------------------
# Path where the Makefile can find additional executables
#-----------------------------------------------------------------------------
CMD_PATH = $(subst \,\\,$(MAKESUPPORT_DIR))/cmd

#-----------------------------------------------------------------------------
# Shell used by Makefile
#-----------------------------------------------------------------------------
SHELL    = $(CMD_PATH)/sh

#-----------------------------------------------------------------------------
# $(MAKEDEPEND) defines the C-Preprocessor used for the automatic dependency
# generation.
#-----------------------------------------------------------------------------
MAKEDEPEND  = $(CMD_PATH)/cpp0

#-----------------------------------------------------------------------------
# Command to copy a file or directory
#-----------------------------------------------------------------------------
CP       = $(CMD_PATH)/cp -f

#-----------------------------------------------------------------------------
# Command to remove a file without user requests
#-----------------------------------------------------------------------------
RM       = $(YES) n | $(CMD_PATH)/rm

#-----------------------------------------------------------------------------
# Command to remove a whole directory recursively without user requests
#-----------------------------------------------------------------------------
RRM      = $(YES) n | $(CMD_PATH)/rm -r

#-----------------------------------------------------------------------------
# Command to rename ore move a file or directory
#-----------------------------------------------------------------------------
MV       = $(CMD_PATH)/mv -f

#-----------------------------------------------------------------------------
# Command to print out a text to standard out
# escape sequences are suppressed
#-----------------------------------------------------------------------------
ECHO     = $(CMD_PATH)/echo -E

#-----------------------------------------------------------------------------
# Command to print out a text to standard out
# escape sequences are interpreted
#-----------------------------------------------------------------------------
ECHOESC   = $(CMD_PATH)/echo

#-----------------------------------------------------------------------------
# Command to create a directory
#-----------------------------------------------------------------------------
MKDIR    = $(CMD_PATH)/mkdir

#-----------------------------------------------------------------------------
# Stream Editor
#-----------------------------------------------------------------------------
SED      = $(CMD_PATH)/sed

#-----------------------------------------------------------------------------
# GAWK
#-----------------------------------------------------------------------------
GAWK     = $(CMD_PATH)/gawk

#-----------------------------------------------------------------------------
# Tee
#-----------------------------------------------------------------------------
TEE      = $(CMD_PATH)/tee -a

#-----------------------------------------------------------------------------
# Cat
#-----------------------------------------------------------------------------
CAT      = $(CMD_PATH)/cat

#-----------------------------------------------------------------------------
# Yes
#-----------------------------------------------------------------------------
YES      = $(CMD_PATH)/yes

#-----------------------------------------------------------------------------
# XSLT processor
#-----------------------------------------------------------------------------
XSLT     = $(CMD_PATH)/xslt/XslTransCmd.exe

#-----------------------------------------------------------------------------
# XSL Sheet for releasesheet transformation
#-----------------------------------------------------------------------------
RELSHEET_XSL = $(CMD_PATH)/xslt/ReleaseSheet.xslt

#-----------------------------------------------------------------------------
# Current working dir
#-----------------------------------------------------------------------------
CURDIR = $(shell cmd /c cd)

#-----------------------------------------------------------------------------
# copy
#-----------------------------------------------------------------------------
XCOPY = xcopy /Q /Y

#-----------------------------------------------------------------------------
# Gnu Size Utility included
#-----------------------------------------------------------------------------
GSIZE = $(CMD_PATH)/size

#-----------------------------------------------------------------------------
# PC-Lint
# PCLint command file must have the suffix lnt
#-----------------------------------------------------------------------------
ifeq ($(PCLINT),)
PCLINT      = c:\uti\lint\8.0\lint-nt
endif
ifeq ($(PCLINT_FILE),)
PCLINT_FILE = .\pclint.lnt
endif
PCLINT_UNIX = $(subst \,/,$(PCLINT))
PCLINT_CMD  = $(subst \,/,$(PCLINT_FILE))


##############################################################################
# Check if necessary Variables are defined
##############################################################################

#-----------------------------------------------------------------------------
# $(MUSTVAR_LIST) contains all variables needed by MakeSupport
#-----------------------------------------------------------------------------
MUSTVAR_LIST = COMPILER_BASE      \
               COMPILER_BIN       \
               ROOT               \
               CC                 \
               CINC               \
               LD                 \
               LNK_SUFFIX         \
               BINARY_SUFFIX      \
               OBJ_SUFFIX         \
               PROJECT_NAME       \
               OBJ_OUTPUT         \
               ERR_OUTPUT         \
               OBJ_PATH           \
               ERR_PATH           \
               LST_PATH           \
               LOG_PATH

MUSTVAR_LIST_3_10 = LIB_SUFFIX         \
                    LIB_PATH

MUSTVAR_LIST += $(MUSTVAR_LIST_$(MODULE_VERSION)_$(VERSION))

MISSING_VARS = $(filter __MISSING_VAR__%,                                \
                   $(foreach MUSTVAR,$(MUSTVAR_LIST),                    \
                       $(subst ,__MISSING_VAR__$(MUSTVAR),$($(MUSTVAR))) \
                   ) \
               )

MISSING_CONF_VARS = $(filter __MISSING_VAR__%,                                \
                        $(foreach MUSTVAR,$(REQUIRED_MK_CONF_VARS),           \
                            $(subst ,__MISSING_VAR__$(MUSTVAR),$($(MUSTVAR))) \
                        ) \
                    )



ifneq ($(MISSING_CONF_VARS),)
  $(error Variable(s) $(subst __MISSING_VAR__,,$(MISSING_CONF_VARS)) are missing or not configured correctly in Makefile.config)
endif

ifneq ($(MISSING_VARS),)
  $(error Variable(s) $(subst __MISSING_VAR__,,$(MISSING_VARS)) are missing)
endif

ifeq ($(GENTOOL_DIR),)
  $(error Variable GENTOOL_DIR is not defined in _Makefile.project.part.defines)
endif


##############################################################################
# Derivative control
##############################################################################

#-----------------------------------------------------------------------------
# Retrieve CPU type (grep C_PROCESSOR_*_DERIVATIVE from $(V_CFG_LOC)\v_cfg.h)
#-----------------------------------------------------------------------------
ifeq ($(USE_V_CFG),)
    USE_V_CFG = 1
endif

ifeq ($(USE_V_CFG),1)
    V_CFG = $(subst \,/,$(V_CFG_LOC)/v_cfg.h)
    V_CFG_DETECTED = 1
    ifeq ($(CPU_TYPE),)
        CPU_TYPE  = $(firstword \
                        $(shell if [ -f $(V_CFG) ] ; then \
                            $(SED) -n 's/^[ \t]*\#define[ \t]*C_PROCESSOR_\([_A-Z0-9]*\)/\1/p' $(V_CFG) | \
                            $(SED) 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'; \
                        else \
                            $(ECHO) "FILE_NOT_FOUND"; \
                        fi) \
                    NONE_FOUND)
    endif
endif


ifeq ($(CPU_TYPE),)
    $(error CPU type is not defined (it can be set manually in Makefile) ! \
            Supported types are: $(SUPPORTED_CPU) \
    )
else
    ifeq ($(findstring $(CPU_TYPE),$(SUPPORTED_CPU)),)
        ifeq ($(CPU_TYPE), FILE_NOT_FOUND)
            $(error "v_cfg.h" cannot be found in directory "$(V_CFG_LOC)")
        else
            $(error CPU type ($(CPU_TYPE)) not supported by Makefile. \
                    Supported types are: $(SUPPORTED_CPU) \
            )
        endif
    endif
endif

##############################################################################
# Construction of source list
##############################################################################

#-----------------------------------------------------------------------------
# $(MODULE_LIST) contains all modules supported by MakeSupport
#-----------------------------------------------------------------------------
MODULE_LIST_OLD   += BRS               \
                     VECTOR_STD_LIB    \
                     COMMON_VSTDLIB    \
                     CAN               \
                     LIN               \
                     IL_GM             \
                     DBKOM             \
                     DOIP              \
                     MM                \
                     CMHA              \
                     NMNI              \
                     NMUD              \
                     NMOSEK_D          \
                     NMOSEK_I          \
                     NMGMLAN           \
                     NMIVLAN           \
                     NMFIAT30          \
                     NMFIAT15          \
                     NMJUNIOR          \
                     NMFIATMASTER      \
                     NMFIATC_GW        \
                     ONMX_OSEK_DC      \
                     ONMX_BMW          \
                     NMTOYOTAC         \
                     NMVAGC            \
                     NMPT              \
                     NMCANC            \
                     NMH               \
                     NMFIATC_STD       \
                     TP_ISO_SC         \
                     TP_ISO_MC         \
                     TP_GM_SC          \
                     TP_VW16           \
                     TP_VW20_SC        \
                     TP_VW20           \
                     TP_ISO_LIN        \
                     TP_IVLAN          \
                     GW_AS_DC          \
                     GW_CAN_DC         \
                     GW_ROUTE__BASE    \
                     GW_ROUTEMSG       \
                     GW_ROUTESIG       \
                     GW_ROUTETP        \
                     CANDESC           \
                     CANDESC_BASIC     \
                     SDCOM             \
                     CIO               \
                     SBC               \
                     SPI               \
                     CCP               \
                     XCP               \
                     DPM               \
                     FRFM              \
                     FBL_EEPDRV        \
                     FBL_SECMOD_3SOFT  \
                     FBL_SECMOD_VECTOR \
                     FBL_SECMOD_VENDOR \
                     J1939_BASE        \
                     J1939_VECU        \
                     J1939_TP_BAM      \
                     J1939_TP_CMDT     \
                     J1939_IL          \
                     J1939_DIAG        \
                     J1939_DYN_NM      \
                     ISO11783_ETP      \
                     ISO11783_WS       \
                     NMEA2000_FTP      \
                     NMEA2000_IL       \
                     NMVAGC_MASTER     \
                     NMVAGC_SLAVE      \
                     NMVAGC_BASIC      \
                     NMBASIC           \
                     CANFBL            \
                     NM_UD             \
                     SOMEIP            \
                     SD                \
                     TPAV

MODULE_LIST_NEW   += AUTOSAROS                  \
                     CCL_ASR4COMM               \
                     CCL_ASR4SMCAN              \
                     CDD_ASRCDD_FIAT            \
                     CCL_ASRCOMM                \
                     CCL_ASRCOMMEBBMWSUB        \
                     CCL_ASRSMCAN               \
                     CCL_ASRSMLIN               \
                     CCL_ASRSMFR                \
                     CCL_ASRSMETH               \
                     CCL_CCLCOM                 \
                     CCL_DPM                    \
                     CCL_VSMEBBMWSUB            \
                     CCL_BAIC                   \
                     CCL_BMW                    \
                     CCL_DC                     \
                     CCL_FAW                    \
                     CCL_FIAT                   \
                     CCL_FORD                   \
                     CCL_GAC                    \
                     CCL_GM                     \
                     CCL_HMC                    \
                     CCL_HONDA                  \
                     CCL_MAN                    \
                     CCL_MMC                    \
                     CCL_NAC                    \
                     CCL_PAG                    \
                     CCL_PSA                    \
                     CCL_RENAULT                \
                     CCL_SYMC                   \
                     CCL_TOYOTA                 \
                     CCL_VAG                    \
                     CCL_VECTOR                 \
                     COMMON_SIPVERSIONCHECK     \
                     CP_ASRCCP                  \
                     CP_CCP                     \
                     CP_XCP                     \
                     CP_ASRXCP                  \
                     CP_XCPONCAN                \
                     CP_XCPONCANASR             \
                     CP_XCPONFR                 \
                     CP_XCPONFRASR              \
                     CP_XCPONLIN                \
                     DIAG_ASRDCM                \
                     DIAG_ASRDCM_TOYOTA         \
                     DIAG_ASRDCMEBBMWSUB        \
                     DIAG_ASRDCMI2SAUDISUB      \
                     DIAG_ASR4DEM               \
                     DIAG_ASRDEM                \
                     DIAG_ASRDEMEBBMWSUB        \
                     DIAG_ASRDEMI2SAUDISUB      \
                     DIAG_ASRDEM_DAIMLER        \
                     DIAG_ASRDEM_FIAT           \
                     DIAG_ASRDEM_FORD           \
                     DIAG_ASRDEM_VECTOR         \
                     DIAG_ASRDEM_VOLVO_AB       \
                     DIAG_CANDESC               \
                     DIAG_CANDESC_BASIC         \
                     DIAG_CANDESCGGDAEXT_GM     \
                     DIAG_CDCEBBMWSUB           \
                     DIAG_DARHVECTORBMWSUB      \
                     DIAG_DIAGEBBMWSUB          \
                     DIAG_ELAPCU                \
                     DIAG_FAULTMEMORY           \
                     DIAG_SDCOM_DC              \
                     DIAGLIN                    \
                     DRVADC                     \
                     DRVCAN                     \
                     DRVCAN_ASR                 \
                     DRVCRC_TMS570TIMCRC01ASR   \
                     DRVDIO                     \
                     DRVEED                     \
                     DRVEEP                     \
                     DRVEEP_XAT25128EASR        \
                     DRVEEP_XXSTUBASR           \
                     DRVETH                     \
                     DRVFLS                     \
                     DRVFLS_XXADBUS01EASR       \
                     DRVFLS_XXSPI01EASR         \
                     DRVFLS_XXSTUBASR           \
                     DRVFLS_MCS12XFSLFTM01EXTVX \
                     DRVFR                      \
                     DRVGPT                     \
                     DRVICU                     \
                     DRVICU_TMS570TINHET01EXTVX \
                     DRVLIN                     \
                     DRVLIN_ASR                 \
                     DRVMCU                     \
                     DRVPORT                    \
                     DRVPWM                     \
                     DRVSPI                     \
                     DRVTRANS                   \
                     DRVWD                      \
                     DRVWD_XTLE4278GEASR        \
                     DRVWD_XXSTUBASR            \
                     DRVTRANS_AR7000ETHASR      \
                     DRVTRANS_BCM89810ETHASR    \
                     DRVTRANS_DP83848ETHASR     \
                     DRVTRANS_E52013CANSPIASR   \
                     DRVTRANS_GENERICETHMIIASR  \
                     DRVTRANS_INT6400ETHASR     \
                     DRVTRANS_TJA1040CANDIOASR  \
                     DRVTRANS_TJA1041CANDIOASR  \
                     DRVTRANS_TJA1043CANDIOASR  \
                     DRVTRANS_TJA1050CANDIOASR  \
                     DRVTRANS_TJA1055CANDIOASR  \
                     DRVTRANS_TJA1145CANSPIASR  \
                     DRVTRANS_TJA1080FRDIOASR   \
                     DRVTRANS_TLE7259LINDIOASR  \
                     DRVTRANS_TLE62512GCANDIOASR \
                     DRVTRANS_CANOEEMUETHASR    \
                     ECUAB_ASRIOHWAB            \
                     ETHTRCV                    \
                     FBLCAN                     \
                     FBLSECMOD_3SOFT_DC         \
                     FBLSECMOD_FORD             \
                     FBLSECMOD_VX_DC            \
                     GW_ADMIN_DC                \
                     GW_ASRPDUR                 \
                     GW_ASRPDURCFG5             \
                     GW_DYNAMICCANINTERFACE     \
                     GW_DYNAMICFRINTERFACE      \
                     GW_GATEWAY                 \
                     IF_ASRIFCAN                \
                     IF_ASRIFEA                 \
                     IF_ASRIFEABASIC            \
                     IF_ASRIFEEP                \
                     IF_ASRIFFEE                \
                     IF_ASRIFFEEMB9DF126FUJI01SUB \
                     IF_ASRIFFEENECLIB          \
                     IF_ASRIFFEEV85XNEC01SUB    \
                     IF_ASRIFFEEV85XNEC02SUB    \
                     IF_ASRIFFEEV85XNEC03SUB    \
                     IF_ASRIFFEEV85XNEC04SUB    \
                     IF_ASRIFFEEV85XNEC05SUB    \
                     IF_ASRIFFEEV85XNEC07SUB    \
                     IF_ASRIFFEEV85XNEC08SUB    \
                     IF_ASRIFFRDRVTRANS         \
                     IF_ASRIFFR                 \
                     IF_ASRIFLIN                \
                     IF_ASRIFMEM                \
                     IF_ASRIFWD                 \
                     IF_ASRIFWDV85XNEC01SUB     \
                     IF_ASRIFETH                \
                     IF_ASRIFSOAD               \
                     IF_VXIFMOST                \
                     IL_ASRCOM                  \
                     IL_ASRCOMCFG5              \
                     IL_ASRIPDUM                \
                     IL_ASRIPDUMCFG5            \
                     IL_ASRIPDUMEBBMWSUB        \
                     IL_ASRIPDUMISBMWSUB        \
                     IL_DBKOM                   \
                     IL_DBKOMPWRTRAINEXT_DC     \
                     IL_GMLAN2X                 \
                     IL_MM_BMW                  \
                     IL_NI_FORD                 \
                     IL_VECTOR_GM               \
                     ILFR_SIGIF_VECTOR          \
                     I2S_DIAG_UDS               \
                     J1939_ROUTER               \
                     LIB_SRVBMWSUB              \
                     MEMSERVICE_ASRNVM          \
                     MONITORING_RTM             \
                     NMJ1939_BASE               \
                     NMJ1939_DYNAMIC            \
                     NM_ASR4NMIF                \
                     NM_ASRNMCAN                \
                     NM_ASRNMCANWRAPPEREXT      \
                     NM_ASRNMCLASSB_FIAT        \
                     NM_ASRNMDIROSEK            \
                     NM_ASRNMFR                 \
                     NM_ASRNMFR_VAG             \
                     NM_ASRNMGENERIC            \
                     NM_ASRNMGENERIC_VAG        \
                     NM_ASRNMIF                 \
                     NM_ASRNMUDP                \
                     NM_ASRNMLIN                \
                     NM_BCAN_HONDA              \
                     NM_CBDNMIF                 \
                     NM_CLASSB_FIAT             \
                     NM_DIROSEK                 \
                     NM_DIROSEKEXT_VAG          \
                     NM_DIROSEKUSERDATA_DC      \
                     NM_GMLAN_GM                \
                     NM_IND_VAG                 \
                     NM_INDOSEK                 \
                     NM_IVLAN                   \
                     NM_JUNIOR                  \
                     NM_PWRTRAIN_CHERY          \
                     NM_PWRTRAIN_FIAT           \
                     NM_PWRTRAIN_MAZDA          \
                     NM_PWRTRAIN_MMC            \
                     NM_PWRTRAIN_VAG            \
                     NM_PWRTRAINBASIC           \
                     NM_STMGRINDOSEK_HS         \
                     NM_STMGRINDOSEK_LS         \
                     NM_STMGRINDOSEK_PSARENAULT \
                     QNX_WRAPPERMD              \
                     QNX_WRAPPERQNX             \
                     RTE                        \
                     SAFETEY_LAYERCAN           \
                     SWC_BMBMWSUB               \
                     SWC_CODINGBMWSUB           \
                     SWC_DARHBMWSUB             \
                     SWC_DLOGBMWSUB             \
                     SWC_FNMBMWSUB              \
                     SWC_OMCBMWSUB              \
                     SWC_PIACLIENTBMWSUB        \
                     SWC_PROGBMWSUB             \
                     SWC_RMHBMWSUB              \
                     SWC_STDDIAGBMWSUB          \
                     SWC_STMBMWSUB              \
                     SWC_SYSTIMEBMWSUB          \
                     SWC_WURBMWSUB              \
                     SYSSERVICE_ANM_VOLVO_AB    \
                     SYSSERVICE_ASRBSWM         \
                     SYSSERVICE_ASR4BSWM        \
                     SYSSERVICE_ASRCAL          \
                     SYSSERVICE_ASRCRC          \
                     SYSSERVICE_ASRDET          \
                     SYSSERVICE_ASR4ECUM        \
                     SYSSERVICE_ASRECUM         \
                     SYSSERVICE_ASRFIM          \
                     SYSSERVICE_ASRRAMTST       \
                     SYSSERVICE_ASRSCHM         \
                     SYSSERVICE_ASRVMM          \
                     SYSSERVICE_ASRWDM          \
                     SYSSERVICE_CODINGEBBMWSUB  \
                     SYSSERVICE_CMPR            \
                     SYSSERVICE_CPLCVSUB        \
                     SYSSERVICE_CRC_BMW         \
                     SYSSERVICE_CRYPTO          \
                     SYSSERVICE_CRYPTO_BMW      \
                     SYSSERVICE_CRYPTOEBBMWSUB  \
                     SYSSERVICE_CSMEBBMWSUB     \
                     SYSSERVICE_DNS             \
                     SYSSERVICE_E2ELIBTTTECHSUB \
                     SYSSERVICE_EEPM            \
                     SYSSERVICE_EXI             \
                     SYSSERVICE_FREETIMEREBBMWSUB \
                     SYSSERVICE_IPBASE          \
                     SYSSERVICE_ISSM_VOLVO_AB   \
                     SYSSERVICE_JSON            \
                     SYSSERVICE_PIAISBMWSUB     \
                     SYSSERVICE_SD              \
                     SYSSERVICE_SOMEIP          \
                     SYSSERVICE_SSWRCS_DAIMLER  \
                     SYSSERVICE_SSWSCC          \
                     SYSSERVICE_SYSTIMEEBBMWSUB \
                     SYSSERVICE_TLS             \
                     SYSSERVICE_XMLENGINE       \
                     TP_16_VAG                  \
                     TP_20_VAG                  \
                     TP_20DIAG_VAG              \
                     TP_20VOLL_VAG              \
                     TP_ASRTPCAN                \
                     TP_ASRTPDOIP               \
                     TP_ASRTPFR                 \
                     TP_ASRTPFREBBMWSUB         \
                     TP_ASRTPLIN                \
                     TP_IEEE1722AVTP            \
                     TP_HTTP                    \
                     TP_IPV4                    \
                     TP_IPV6                    \
                     TP_ISO15765                \
                     TP_ISO15765SINGLECHANNEL   \
                     TP_ISO10681                \
                     TP_TCPIP                   \
                     TP_MCAN_RENAULT            \
                     TPJ1939_ASRBASE            \
                     TPJ1939_BAM                \
                     TPJ1939_CMDT               \
                     TPJ1939_FP                 \
                     TPJ1939_ETP                \
                     TPLIN                      \
                     VAG_ERRMEM                 \
                     VAG_BAP                    \
                     VDOCCL_COMMON              \
                     VDOIL_CMH                  \
                     VDONM_CLASSC_DCVAG         \
                     VDOTP_20_VAG               \
                     VDOTP_IVLAN                \
                     VSTDLIB                    \
                     ZBRS

MODULE_LIST_COMMON = OSEKOS                     \
                     IL_VECTOR                  \
                     DIAG_DC                    \
                     DIAG_X                     \
                     DIAG_X_VAG                 \
                     DIAG_X_SCANIA              \
                     DIAG_X_RENAULT             \
                     DIAG_X_PSA                 \
                     DIAG_X_PAG                 \
                     DIAG_X_MAN                 \
                     DIAG_X_ISO15765_VECTOR     \
                     DIAG_X_HMC                 \
                     DIAG_X_FORD                \
                     DIAG_X_FIAT                \
                     DIAG_X_DC                  \
                     DIAG_X_DAF                 \
                     CCL                        \
                     TP_MCNET


MODULE_LIST += $(sort $(MODULE_LIST_OLD) $(MODULE_LIST_NEW) $(MODULE_LIST_COMMON) $(MODULE_LIST_PROJECT))

#-----------------------------------------------------------------------------
# $(MODULE_SOURCE_LIST) + $(MODULE_DATA_LST) contains all modules supported
# by MakeSupport
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
MODULE_USED_LST        := $(filter-out 0, \
                             $(foreach MODULE,$(MODULE_LIST), \
                                 $(subst 1,$(MODULE),$($(MODULE)_USED)) \
                             ) \
                         )

ifeq ($(USE_AUTOSAR_MAKE),1)
  asrDir  = $(firstword $(filter-out ���,$(subst \ , ,$($(1)_PATH)  ���)))
  asrName = $(notdir $(call asrDir,$(1)))

  ASR_MODULE_USED_LST = $(filter-out OSEKOS,$(MODULE_USED_LST))

  # Consistancy Check of MPPD
  $(foreach MODULE,$(ASR_MODULE_USED_LST), \
    $(if $(call asrDir,$(MODULE)),, \
      $(error Error: Module $(MODULE) is not in Makefile.project.part.defines with $(MODULE)_PATH) \
    ) \
  )

  # Variable definition for AUTOSAR files
  OBJ_FILE_SUFFIX = $(OBJ_SUFFIX)
  OBJ_OUTPUT_PATH = $(OBJ_PATH)


  include $(foreach MODULE,$(ASR_MODULE_USED_LST),$(ROOT)\$(call asrDir,$(MODULE))\mak\$(call asrName,$(MODULE))_rules.mak \
                                              $(ROOT)\$(call asrDir,$(MODULE))\mak\$(call asrName,$(MODULE))_defs.mak  \
                                              $(ROOT)\$(call asrDir,$(MODULE))\mak\$(call asrName,$(MODULE))_check.mak)

  # Consistancy Check of ASR Makefiles
  $(foreach LIB,$(LIBRARIES_TO_BUILD), \
    $(if $($(LIB)_FILES),,$(error Library $(LIB) has no corrospending $(LIB)_FILES definition)) \
  )


  MODULE_SOURCE_LST    = $(addprefix $(if $(GLOBAL_COMP_DIR),\$(GLOBAL_COMP_DIR),),$(addprefix \,$(CC_FILES_TO_BUILD)))
  MODULE_DATA_LST      = $(filter-out %.$(ASM_SUFFIX),$(GENERATED_SOURCE_FILES))
  MODULE_COMMON_LST    = $(COMMON_SOURCE_FILES)

  ASM_SOURCES          += $(foreach ASM,$(ASM_FILES_TO_BUILD),$(subst \,/,$(ROOT)/$(GLOBAL_COMP_DIR)/$(ASM))) $(filter %.$(ASM_SUFFIX),$(GENERATED_SOURCE_FILES))

  ADDITIONAL_INCLUDES  += $(foreach IPATH,$(CC_INCLUDE_PATH),$(ROOT)\$(GLOBAL_COMP_DIR)\$(IPATH))
  ADDITIONAL_INCLUDES  += $(foreach IPATH,$(CPP_INCLUDE_PATH),$(ROOT)\$(GLOBAL_COMP_DIR)\$(IPATH))
  ADDITIONAL_INCLUDES  += $(foreach IPATH,$(ASM_INCLUDE_PATH),$(ROOT)\$(GLOBAL_COMP_DIR)\$(IPATH))
  
  ADDITONAL_LIBRARIES  += $(foreach LIB,$(LIBRARIES_LINK_ONLY),$(ROOT)\$(GLOBAL_COMP_DIR)\$(LIB))
  ADDITIONAL_OBJECTS   += $(foreach OBJ,$(OBJECTS_LINK_ONLY),$(ROOT)\$(GLOBAL_COMP_DIR)\$(OBJ))
  

  AUTOSAROS_DATA = $(strip \
                     $(foreach SOURCE,$(MODULE_DATA_LST), \
                       $(if $(findstring $(GENDATA_OS_DIR),$(SOURCE)), \
                         $(SOURCE) \
                        ) \
                      ) \
                    )
                    
  MODULE_SOURCE_LST_LC = $(call _toLower,$(MODULE_SOURCE_LST) )
  
  #Add ??? to avoid multiple findings
  #findstring ???nm/ in ???cnm/cnm.c ???nm/nm.c
  compSources = $(strip  $(foreach SOURCE,$(MODULE_SOURCE_LST_LC), \
                           $(if $(findstring $(call _toLower,???\$(call asrDir,$(1)))\,???$(SOURCE)),$(SOURCE)) \
                  )  )
  
  lib$(PROJECT_NAME)_FILES =  $(foreach MODULE,$(sort $(MODULE_SOURCE_LST)), \
                                $(addprefix $(OBJ_PATH)/,$(addsuffix .$(OBJ_SUFFIX),$(basename $(notdir $(MODULE))))) \
                              )
  libObjects = $(addprefix $(OBJ_PATH)/,$(addsuffix .$(OBJ_SUFFIX),$(basename $(notdir $($(1)_FILES)))))
else
  MODULE_USED_STATIC_LST := $(filter-out 0, \
                               $(foreach MODULE,$(MODULE_LIST), \
                                   $(subst 1,$(if $($(MODULE)_SOURCES),$(MODULE),0),$($(MODULE)_USED)) \
                               ) \
                           )
                           
  LIBRARIES_TO_BUILD = $(foreach MODULE,$(MODULE_USED_STATIC_LST), lib$(MODULE))

  MODULE_SOURCE_LST      := $(addprefix \, \
                              $(filter-out 0, \
                                 $(foreach MODULE,$(MODULE_LIST), \
                                     $(subst 1,$($(MODULE)_SOURCES),$($(MODULE)_USED)) \
                                 ) \
                              ) \
                            )

  MODULE_DATA_LST        := $(filter-out 0, \
                               $(foreach MODULE,$(MODULE_LIST), \
                                   $(subst 1,$($(MODULE)_DATA),$($(MODULE)_USED)) \
                               ) \
                           )

  MODULE_SOURCE_LIST_OLD := $(filter-out 0, \
                               $(foreach MODULE,$(MODULE_LIST_OLD), \
                                  $(subst 1,$($(MODULE)_SOURCES),$($(MODULE)_USED)) \
                               ) \
                           )

  MODULE_COMMON_LST      := $(filter-out 0, \
                               $(foreach MODULE,$(MODULE_LIST), \
                                   $(subst 1,$($(MODULE)_COMMON),$($(MODULE)_USED)) \
                               ) \
                           )

  compSources = $($(1)_SOURCES)
  
  $(PROJECT_NAME)_SOURCES = $(MODULE_SOURCE_LST)
  libObjects = $(addprefix $(OBJ_PATH)/,$(addsuffix .$(OBJ_SUFFIX),$(sort $(basename $(notdir $(call compSources,$(subst lib,,$(1))))))))

endif

endif

#-----------------------------------------------------------------------------
# $(BRS_DATA) contains all parts of BRS
# To be compatible to older versions of Makefile.project.part.defines
# the BRS_DATA must be set here if not done before in the Makefile.p.p.d
#-----------------------------------------------------------------------------
ifeq ($(BRS_DATA),)
BRS_DATA = source\brsAddOn.c \
           source\brsCtrl.c  \
           source\brsIntTb.c \
           source\brsHw.c    \
           source\brsMain.c  \
           source\brsStaMa.c \
           source\brsOsek.c
endif

#-----------------------------------------------------------------------------
# List of all sources used (and linked together!) in this project
# Variable $(SOURCES) is used for target compilation
#-----------------------------------------------------------------------------
SOURCES      = $(APP_SOURCE_LST)            \
               $(DATA_SOURCE_LST)           \
               $(MODULE_DATA_LST)           \
               $(sort $(MODULE_COMMON_LST))

SOURCES     += $(sort $(subst ???,\ ,                    \
                  $(addprefix $(ROOT),                  \
                    $(subst \ ,???,$(filter-out $(SOURCES_IN_LIBS),$(MODULE_SOURCE_LST)) ) \
                  )                                      \
               ))

ifeq ($(strip $(OSEKOS_USED)),1)
    ifneq ($(OSEKOS_$(PLATFORM)),)
        SOURCES += $(OSEKOS_$(PLATFORM))
    else
        SOURCES += $(OSEKOS_STAT_SRCS)
    endif
    ADDITIONAL_INCLUDES += $(OSEKOS_PATH)\include
endif

ifeq ($(strip $(AUTOSAROS_USED)),1)
    ifneq ($(OSEKOS_$(PLATFORM)),)
        SOURCES += $(OSEKOS_$(PLATFORM))
    else
        SOURCES += $(OSEKOS_STAT_SRCS)
    endif
    ADDITIONAL_INCLUDES += $(OSEKOS_PATH)\include
    ADDITIONAL_INCLUDES += $(GENDATA_OS_DIR)
endif

SOURCES_UNIX = $(subst ???,\ ,$(subst \,/,$(subst \ ,???,$(SOURCES))))
SOURCES_APPL_UNIX = $(subst ???,\ ,$(subst \,/,$(subst \ ,???,$(APP_SOURCE_LST))))

##############################################################################
# Subdir, Include, File and Patternlist definitions
##############################################################################

#-----------------------------------------------------------------------------
# create subdirs used for err/obj/lst files
##-----------------------------------------------------------------------------
ifeq ($(LIB_PATH),)
LIB_PATH=lib
endif

DIR_LIST = $(OBJ_PATH) $(ERR_PATH) $(LST_PATH) $(LOG_PATH) $(LIB_PATH)

# (ebl) VGI000000164273: totally disable BrsVInfo.h generation if needed
ifneq ($(SKIP_BRSVINFO),1)

# (ebl) VGI140907: MakeSupport BrsVInfo.h Generation
# we don't see a use case where MakeSupport is used by that file must not be
# generated
#
#ifneq ($(findstring 1,$(BRS_USED) $(ZBRS_USED)),)
#    PREDEP += $(GENDATA_DIR_U)/BrsVInfo.h
#else
#    ifeq ($(USE_AUTOSAR_MAKE),1)
        PREDEP += $(GENDATA_DIR_U)/BrsVInfo.h
#    endif
#endif
endif

ifeq ($(strip $(OSEKOS_USED)),1)
    ifeq ($(GENDATA_OS_DIR),)
        GENDATA_OS_DIR  = GenDataOs
    endif
endif

ifeq ($(strip $(AUTOSAROS_USED)),1)
    ifeq ($(GENDATA_OS_DIR),)
        GENDATA_OS_DIR  = GenDataOs
    endif
endif

ifeq ($(GENDATA_DIR),)
    GENDATA_DIR  = $(shell if [ -d data ] ; then $(ECHO) "data"; else $(ECHO) "GenData"; fi)
endif

GENDATA_DIR_U = $(subst \,/,$(GENDATA_DIR))
GENDATA_OS_DIR_U = $(subst \,/,$(GENDATA_OS_DIR))

LINKER_COMMAND_FILE = $(if $(USER_LINKER_COMMAND_FILE),$(USER_LINKER_COMMAND_FILE),$(PROJECT_NAME).$(LNK_SUFFIX))

#-----------------------------------------------------------------------------
# Variable $(SUBDIRS) is used for target clean and compilation
#-----------------------------------------------------------------------------
ifeq ($(USE_AUTOSAR_MAKE),1)
  SUBDIRS               = $(foreach MODULE,$(ASR_MODULE_USED_LST),$(ROOT)\$(call asrDir,$(MODULE)) )
else
  SUBDIRS               = $(subst ???,\ ,$(sort $(foreach ENTRY,$(dir $(subst \ ,???,$(SOURCES))),$(patsubst %\,%,$(ENTRY)))))
endif

SUBDIRS_UNIX            = $(subst ???,\ ,$(subst \,/,$(subst \ ,???,$(SUBDIRS))))

#-----------------------------------------------------------------------------
# all files contained in $(CLEANDIRS) matching $(DEL_PATTERN_LIST) are deleted
# by clean target
#-----------------------------------------------------------------------------

ifeq ($(QUICKBUILD),)

DEL_PATTERN_LIST       += $(PROJECT_NAME).$(LNK_SUFFIX)    \
                          $(PROJECT_NAME).dep              \
                          $(PROJECT_NAME).ilk              \
                          $(OBJ_PATH)\*.*                  \
                          $(ERR_PATH)\*.*                  \
                          $(LST_PATH)\*.*                  \
                          $(LIB_PATH)\*.*                  \
                          $(LOG_PATH)\*.*

DEL_PATTERN_LIST_UNIX   = $(subst \,/,$(DEL_PATTERN_LIST))

CLEANDIRS               = . $(SUBDIRS) $(GENDATA_OS_DIR) $(INCDIR_LIST)
CLEANDIRS_UNIX          = $(subst ???,\ ,$(subst \,/,$(subst \ ,???,$(CLEANDIRS))))
DIST_CLEAN_LIST  = $(sort $(subst \,/,                 \
                       $(DIST_CLEAN_PATTERN_LIST)      \
                       ~vssc                           \
                       vssver.scc                      \
                       *~                              \
                       *.*~                            \
                       *.~*                            \
                       *.bak                           \
                       *.log                           \
                       quickbuild.make                 \
                       $(GENDATA_DIR)\*.txt            \
                       $(ERR_LIST_WOP)                 \
                       $(SIMPLEOS_OIL)_                \
                       $(PROJECT_NAME).dep             \
                       $(PROJECT_NAME).dsw             \
                       $(PROJECT_NAME).dsp             \
                       $(PROJECT_NAME).sln             \
                       $(PROJECT_NAME).vcproj          \
                       $(PROJECT_NAME).suo             \
                       $(PROJECT_NAME).ncb             \
                       $(PROJECT_NAME).opt             \
                       $(PROJECT_NAME).plg             \
                       $(PROJECT_NAME).doc.cfg         \
                       $(GENDATA_DIR)\BrsVInfo.h       \
                   ))
endif

#-----------------------------------------------------------------------------
# $(GCCINCLUDES) and $(INCLUDES) contain the include path
# Users can append additional include paths by defining ADDITIONAL_INCLUDES
#-----------------------------------------------------------------------------
CPPFLAGS     = -M
ifeq ($(STRICT_C_OFF),)
    CPPFLAGS += -std=c89  \
                -pedantic \
                -Wall
else
    CPPFLAGS += -lang-c++ \
                -w
endif

ifeq ($(QUICKBUILD),)
COMMON_INC   = $(shell if [ -d $(subst \,/,$(ROOT)\_Common) ] ; then $(ECHO) "$(ROOT)\_Common"; fi)\
               $(shell if [ -d $(subst \,/,$(ROOT)\BSW\_Common) ] ; then $(ECHO) "$(ROOT)\BSW\_Common"; fi)
FBLCAN_INC   = $(if $(findstring 1,$(FBLCAN_USED) $(CANFBL_USED)),$(ROOT)\drvflash $(ROOT)\BSW\Flash)
CPPFLAGS    += $(foreach DEF,$(DEP_DEFINES),-D$(DEF))
GCCINC_LIST  = $(subst \,/,$(subst \ ,???,                \
                        $(COMMON_INC)                     \
                        $(FBLCAN_INC)                     \
                        include                           \
                        $(GENDATA_DIR)                    \
                        $(SUBDIRS)                        \
                        $(COMPILER_INC)                   \
                        $(ADDITIONAL_INCLUDES)))
GCCINCLUDES  = $(subst ???,\ ,$(addprefix -I, $(sort $(call toLower,GCCINC_LIST))))

INCLUDES_UNIX = $(subst ???,\ ,$(subst -I,$(CINC),$(subst \ ,???,$(GCCINCLUDES))))
INCLUDES  = $(subst /,\,$(INCLUDES_UNIX))

CC_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(CC))))
LD_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(LD))))
MA_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(MA))))
AS_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(AS))))
LB_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(LB))))
EXT_T1_U = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(EXT_T1))))
EXT_T2_U = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(EXT_T2))))

ifeq ($(CC_ENV_U),)
CC_ENV_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(CC_ENV))))
endif
ifeq ($(LD_ENV_U),)
LD_ENV_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(LD_ENV))))
endif
ifeq ($(MA_ENV_U),)
MA_ENV_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(MA_ENV))))
endif
ifeq ($(AS_ENV_U),)
AS_ENV_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(AS_ENV))))
endif
ifeq ($(LB_ENV_U),)
LB_ENV_U     = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(LB_ENV))))
endif
ifeq ($(EXT_T1_ENV_U),)
EXT_T1_ENV_U = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(EXT_T1_ENV))))
endif
ifeq ($(EXT_T2_ENV_U),)
EXT_T2_ENV_U = $(subst ?????,\ ,$(subst \,/,$(subst \ ,?????,$(EXT_T2_ENV))))
endif

endif
#-----------------------------------------------------------------------------
# $(OBJECTS) represents the objectfiles which will be linked together
# This var is generated by replacing the suffix of the files defined in
# $(SOURCES) (Makefile.project.part.defines) by .$(OBJ_SUFFIX)
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
ifeq ($(USE_AUTOSAR_MAKE),1)
ADDITONAL_LIBRARIES      = $(foreach LIB,$(LIBRARIES_TO_LINK), $(call libtarget,$(LIB)))
endif
BUILD_OBJECTS           = $(sort $(strip $(subst /,\,$(addprefix $(OBJ_PATH)/,                            \
                              $(addsuffix .$(OBJ_SUFFIX),$(basename $(notdir $(SOURCES) $(ASM_SOURCES)))) \
                          ))))

SOURCES_IN_LIBS         =  $(foreach LIB,$(LIBRARIES_TO_LINK),\
                              $(foreach FILE,$($(LIB)_FILES),\$(GLOBAL_COMP_DIR)\$(FILE)) \
                            )

OBJECTS                 = $(sort $(strip $(subst /,\,$(BUILD_OBJECTS) $(ADDITIONAL_OBJECTS) $(ADDITONAL_LIBRARIES) )))
endif


OBJECTS_U               = $(subst \,/,$(OBJECTS))
BUILD_OBJECTS_U         = $(subst \,/,$(BUILD_OBJECTS))
BUILD_LIBS              = $(addprefix $(LIB_PATH)/,$(addsuffix .$(LIB_SUFFIX), $(sort $(strip $(LIBRARIES_TO_BUILD)))))
BUILD_LIBS             += $(LIB_PATH)/lib$(PROJECT_NAME).$(LIB_SUFFIX)
BUILD_LIBS_U            = $(subst /,\,$(BUILD_LIBS))

#-----------------------------------------------------------------------------
# Function to set all characters in list to upper case
# the parameter is the name of the list
#-----------------------------------------------------------------------------
toUpper = $(subst ~~???~~,\,$(shell $(ECHO) $(subst \,~~???~~,$($(1))) \
              | $(SED) 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
           ))

#-----------------------------------------------------------------------------
# Function to set all characters in list to lower case
# the parameter is the name of the list
#-----------------------------------------------------------------------------
toLower = $(subst ~~???~~,\,$(shell $(ECHO) $(subst \,~~???~~,$($(1))) \
              | $(SED) 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \
           ))

#-----------------------------------------------------------------------------
# Function to set all characters in list to upper case
# the parameter is the list
#-----------------------------------------------------------------------------
_toUpper = $(subst ~~???~~,\,$(shell $(ECHO) $(subst \,~~???~~,$(1)) \
              | $(SED) 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
           ))

#-----------------------------------------------------------------------------
# Function to set all characters in list to lower case
# the parameter is the list
#-----------------------------------------------------------------------------
_toLower = $(subst ~~???~~,\,$(shell $(ECHO) $(subst \,~~???~~,$(1)) \
              | $(SED) 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \
           ))

#-----------------------------------------------------------------------------
# Function to perform a xcopy which accepts normal slashes
#-----------------------------------------------------------------------------
_xcopy = $(XCOPY) $(subst /,\\,$(subst \,\\,$(1))) $(subst /,\\,$(subst \,\\,$(2))) 1>/dev/null;

#-----------------------------------------------------------------------------
# Function to generate a separated List
# First parameter is the name!!! of list, second is the name!! of the separator
#-----------------------------------------------------------------------------
_EMPTY      :=
_SPACE      := $(_EMPTY) $(_EMPTY)
_SEMI_COLON  = ;
_COLON       = :
_COMMA       = ,
_OPEN_PAREN  = (
_CLOSE_PAREN = )
_DQUOTE      = "
SEPLIST_SPACE =????? #

separatedList = $(strip $(subst $(SEPLIST_SPACE),,                             \
                    $(filter-out $(word $(words $($(1))),$($(1)))$($(2))?????, \
                         $(addsuffix $($(2))?????,$($(1)))                     \
                     ) $(word $(words $($(1))),$($(1)))                        \
                 ))

#-----------------------------------------------------------------------------
# Function to generate a separated List
# First parameter is the list, second is the name!! of the separator
#-----------------------------------------------------------------------------
_separatedList = $(strip $(subst $(SEPLIST_SPACE),,                            \
                    $(filter-out $(word $(words $(1)),$(1))$($(2))?????,       \
                         $(addsuffix $($(2))?????,$(1))                        \
                     ) $(word $(words $(1)),$(1))                              \
                 ))

#-----------------------------------------------------------------------------
# Function to get the index of an entry in a given list
# First parameter is the entry to be searched, second is the list
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
NUMBER_LIST =  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20 \
              21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40 \
              41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60 \
              61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80 \
              81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 \
             101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 \
             121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 \
             141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 \
             161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 \
             181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 \
             201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 \
             221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 \
             241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 \
             261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 \
             281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 \
             301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 \
             321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 \
             341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 \
             361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 \
             381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 \
             401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 \
             421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 \
             441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 \
             461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 \
             481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 \
             501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 \
             521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 \
             541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 \
             561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 \
             581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 \
             601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 \
             621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 \
             641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 \
             661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 \
             681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 \
             701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 \
             721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 \
             741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 \
             761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 \
             781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 \
             801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 \
             821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 \
             841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 \
             861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 \
             881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 500 \
             901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 \
             921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 \
             941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 \
             961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 \
             981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000

index  = $(patsubst %-***-$(1),%,$(filter %-***-$(1),$(join $(addsuffix -***-,$(NUMBER_LIST)),$(2))))
index0 = $(patsubst %-***-$(1),%,$(filter %-***-$(1),$(join $(addsuffix -***-,0 $(NUMBER_LIST)),$(2))))

endif
#-----------------------------------------------------------------------------
# Function to patch lists (all entries are replaced)
# - First parameter is the name of the list which should be patched
# - Second parameter is the name of the list which contains the patterns which
#   should be patched
# - Third parameter is the Prefix of the variables which contain the
#   replacements for the patterns
# E.g:
#   PATCHLIST = this is a list
#   PATTERNS  = this a
#   REPL_this = THIS
#   REPL_a    = A
#   PATCHEDLIST = $(call patchList,PATCHLIST,PATTERNS,REPL_)
#
#   After the last assignment $(PATCHEDLIST) contains: THIS is A list
#-----------------------------------------------------------------------------
patchList = $(shell $(ECHO) $($(1)) \
                | $(SED) $(foreach ENTRY,$(strip $($(2))),-e s/$(ENTRY)/$($(3)$(ENTRY)))/g) \
             )

#-----------------------------------------------------------------------------
# Function to patch lists (all entries are replaced)
# - First parameter is the name of the file which should be patched
# - Second parameter is the name of the file for the results
# - Third parameter is the name of the list which contains the patterns which
#   should be patched
# - Fourth parameter is the Prefix of the variables which contain the
#   replacements for the patterns
# E.g:
#   PATCHLIST = this is a list
#   PATTERNS  = this a
#   REPL_this = THIS
#   REPL_a    = A
#   PATCHEDLIST = $(call patchList,PATCHLIST,PATTERNS,REPL_)
#
#   After the last assignment $(PATCHEDLIST) contains: THIS is A list
#-----------------------------------------------------------------------------
patchFile = $(shell $(SED) $(foreach ENTRY,$(strip $($(3))),-e s/$(ENTRY)/$($(4)$(ENTRY))/g) $(subst \,/,$(1) > $(2)))

#-----------------------------------------------------------------------------
# Function returns number of characters in parameter
#-----------------------------------------------------------------------------
countChars = $(shell firstString="$(1)"; $(ECHO) $${\#firstString} )

#-----------------------------------------------------------------------------
# Function to overwrite parts of a string by another string
# - First parameter is the string to be overwritten
# - Second parameter is the string which overwrites the first
#-----------------------------------------------------------------------------
overwriteString = $(shell                                           \
                        frstString="$(1)";                          \
                        scndString="$(2)";                          \
                        $(ECHO) $${scndString:$$[$${\#frstString}]} \
                   )

##############################################################################
# FLAG compilation
##############################################################################
ifeq ($(QUICKBUILD),)
CFLAGS  += $(CFLAGS_ADDITIONAL_PRE)  \
           $(CFLAGS_OPTIMIZATION)    \
           $(CFLAGS_WARNING)         \
           $(CFLAGS_MEMORYMODEL)     \
           $(CFLAGS_ADDITIONAL_POST)

MAFLAGS += $(MAFLAGS_ADDITIONAL_PRE) \
           $(MAFLAGS_OPTIMIZATION)   \
           $(MAFLAGS_WARNING)        \
           $(MAFLAGS_MEMORYMODEL)    \
           $(MAFLAGS_ADDITIONAL_POST)

ASFLAGS += $(ASFLAGS_ADDITIONAL_PRE) \
           $(ASFLAGS_OPTIMIZATION)   \
           $(ASFLAGS_WARNING)        \
           $(ASFLAGS_MEMORYMODEL)    \
           $(ASFLAGS_ADDITIONAL_POST)

LDFLAGS += $(LDFLAGS_ADDITIONAL_PRE) \
           $(LDFLAGS_OPTIMIZATION)   \
           $(LDFLAGS_WARNING)        \
           $(LDFLAGS_MEMORYMODEL)    \
           $(LDFLAGS_ADDITIONAL_POST)

CFLAGS_ADDITIONAL  = $(strip $(CFLAGS_ADDITIONAL_PRE)  $(CFLAGS_ADDITIONAL_POST))
MAFLAGS_ADDITIONAL = $(strip $(MAFLAGS_ADDITIONAL_PRE) $(MAFLAGS_ADDITIONAL_POST))
ASFLAGS_ADDITIONAL = $(strip $(ASFLAGS_ADDITIONAL_PRE) $(ASFLAGS_ADDITIONAL_POST))
LDFLAGS_ADDITIONAL = $(strip $(LDFLAGS_ADDITIONAL_PRE) $(LDFLAGS_ADDITIONAL_POST))
endif

##############################################################################
# Rule definitions
##############################################################################

#-----------------------------------------------------------------------------
#$(COMPILE_RULE) implements the Compile rule %.$(OBJ_SUFFIX): %.c. This
#define can be overriden in the project specific Makefile Example:
#override define COMPILE_RULE project specific rule endif
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
define COMPILE_RULE
    if [ -n "$(MKVERBOSE)" ] ; then                                                       \
        $(ECHO) "    $(CC) $(filter-out $(FILTER_$(call _toUpper,$*)),$(CFLAGS)) $(CFLAGS_$(call _toUpper,$*)) $(INCLUDES_UNIX) $< $(REDIRECT_OUTPUT)"; \
    fi;                                                                                   \
    $(subst \,/,$(CC_ENV) $(CC) $(filter-out $(FILTER_$(call _toUpper,$*)),$(CFLAGS)) $(CFLAGS_$(call _toUpper,$*))) $(INCLUDES_UNIX) $< $(REDIRECT_OUTPUT);
endef
endif
#-----------------------------------------------------------------------------
#$(ASSEMBLE_RULE) implements the assemble rule %.$(OBJ_SUFFIX): %.asm. This
#define can be overriden in the project specific Makefile Example:
#override define ASSEMBLE_RULE project specific rule endif
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
define ASSEMBLE_RULE
    if [ -n "$(MKVERBOSE)" ] ; then                                            \
        $(ECHO) "    $(AS) $(ASFLAGS) $(subst /,\,$<) $(REDIRECT_OUTPUT)";     \
    fi;                                                                        \
    $(subst \,/,$(AS_ENV) $(AS) $(ASFLAGS)) $< $(REDIRECT_OUTPUT);
endef
endif
#-----------------------------------------------------------------------------
# $(LINK_RULE) implements the Linking rule
# this define can be overriden in the project specific Makefile
# Example:
#     override define LINK_RULE project specific rule endif
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
define LINK_RULE
    if [ -n "$(MKVERBOSE)" ] ; then                                                          \
        $(ECHO) "    $(LD) $(LDFLAGS) $(LINKER_COMMAND_FILE) $(REDIRECT_OUTPUT)";            \
    fi;                                                                                      \
    $(subst \,/,$(LD_ENV) $(LD) $(LDFLAGS)) $(LINKER_COMMAND_FILE) $(REDIRECT_OUTPUT);
endef
endif
#-----------------------------------------------------------------------------
# $(LIB_RULE) implements the library generation rule
# this define can be overriden in the project specific Makefile
# Example:
#     override define LINK_RULE project specific rule endif
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
define LIB_RULE
    if [ -n "$(MKVERBOSE)" ] ; then                               \
        $(ECHO) "    $(LB) $(LBFLAGS) $^ $(REDIRECT_OUTPUT)";     \
    fi;                                                           \
    $(subst \,/,$(LB_ENV) $(LB) $(LBFLAGS) $^ ) $(REDIRECT_OUTPUT);
endef
endif
#-----------------------------------------------------------------------------
# If a decoder $(DEC) ("lstfile generator") is specified in the project
# specific Makefile it will be called after compilation
# overriding is possible
#-----------------------------------------------------------------------------
ifdef DEC
    define DECODE_RULE
        $(ECHO) "Generating lst files: $<";        \
        if [ -n "$(MKVERBOSE)" ] ; then            \
            $(ECHO) "    $(DEC) $(DECFLAGS)";      \
        fi;                                        \
        $(DEC) $(DECFLAGS);
    endef
else
    define DECODE_RULE
        $(ECHO) -n;
    endef
endif

#-----------------------------------------------------------------------------
# Suffix of generated Object, Error and Link Files
#-----------------------------------------------------------------------------
ifeq ($(OBJ_SUFFIX),)
    OBJ_SUFFIX=o
endif

ifeq ($(ASM_SUFFIX),)
    ASM_SUFFIX=asm
endif

ifeq ($(ERR_SUFFIX),)
    ERR_SUFFIX=err
endif

ifeq ($(LST_SUFFIX),)
    LST_SUFFIX=lst
endif

ifeq ($(LNK_SUFFIX),)
    LNK_SUFFIX=lnk
endif

ifeq ($(LIB_SUFFIX),)
    LIB_SUFFIX=lib
endif

ifeq ($(OBJ_OUTPUT),MOVE)
    #-------------------------------------------------------------------------
    # $(MOVE_OBJECT_RULE) moves generated .$(OBJ_SUFFIX) files to a specific
    # output dir. If the variable $(OBJ_OUTPUT) is set to MOVE in the
    # Makefile, this rule provides automatic movement of the generated object
    # file to the $(OBJ_PATH)
    #-------------------------------------------------------------------------
    define MOVE_OBJECT_RULE
        $(ECHO) "Moving object file: $*.$(OBJ_SUFFIX) -> $(OBJ_PATH)/$*.$(OBJ_SUFFIX)"; \
        if [ -f $*.$(OBJ_SUFFIX) ]; then $(MV) $*.$(OBJ_SUFFIX) $(OBJ_PATH)/$*.$(OBJ_SUFFIX); fi; \
        if [ -f $(<D)/$*.$(OBJ_SUFFIX) ]; then $(MV) $(<D)/$*.$(OBJ_SUFFIX) $(OBJ_PATH)/$*.$(OBJ_SUFFIX); fi;
    endef
else
    define MOVE_OBJECT_RULE
        $(ECHO) -n;
    endef
    ifneq ($(OBJ_OUTPUT),FLAGS)
        $(error Variable OBJ_OUTPUT in <Makefile> is not set correctly)
    endif
endif

ifeq ($(LIB_OUTPUT),)
    LIB_OUTPUT = $(OBJ_OUTPUT)
endif

ifeq ($(LIB_OUTPUT),MOVE)
    #-------------------------------------------------------------------------
    # $(MOVE_LIB_RULE) moves generated .$(LIB_SUFFIX) files to a specific
    # output dir. If the variable $(LIB_OUTPUT) is set to MOVE in the
    # Makefile, this rule provides automatic movement of the generated object
    # file to the $(LIB_PATH)
    #-------------------------------------------------------------------------
    define MOVE_LIB_RULE
        $(ECHO) "Moving library file: $*.$(LIB_SUFFIX) -> $(LIB_PATH)/$*.$(LIB_SUFFIX)"; \
        if [ -f $*.$(LIB_SUFFIX) ]; then $(MV) $*.$(LIB_SUFFIX) $(LIB_PATH)/$*.$(LIB_SUFFIX); fi; \
        if [ -f $(<D)/$*.$(LIB_SUFFIX) ]; then $(MV) $(<D)/$*.$(LIB_SUFFIX) $(LIB_PATH)/$*.$(LIB_SUFFIX); fi;
    endef
else
    define MOVE_LIB_RULE
        $(ECHO) -n;
    endef
    ifneq ($(LIB_OUTPUT),FLAGS)
        $(error Variable LIB_OUTPUT in <Makefile> is not set correctly)
    endif
endif

ifeq ($(ERR_TO_STDOUT),1)
    #-------------------------------------------------------------------------
    # $(PRINT_ERR_TO_STDOUT) prints error file to stdout
    # Turn it on by setting the environment/make variable $(ERR_TO_STDOUT)
    #-------------------------------------------------------------------------
    define PRINT_ERR_TO_STDOUT
        if [ -f $(ERR_PATH)/$*.$(ERR_SUFFIX) ]; then \
            $(CAT) $(ERR_PATH)/$*.$(ERR_SUFFIX);     \
        fi;
    endef

    define RM_ERR_FILE
        if [ -f $(ERR_PATH)/$*.$(ERR_SUFFIX) ]; then \
            $(RM) $(ERR_PATH)/$*.$(ERR_SUFFIX);      \
        fi;
    endef
endif

ifeq ($(ERR_OUTPUT),MOVE)
    #-------------------------------------------------------------------------
    # $(MOVE_ERR_RULE) moves generated .$(ERR_SUFFIX) files to a specific
    # output dir. If the variable $(ERR_OUTPUT) is set to MOVE in the
    # Makefile, this rule provides automatic movement of the generated error
    # file to the $(ERR_PATH)
    #-------------------------------------------------------------------------
    define MOVE_ERR_RULE
        $(ECHO) "Moving error file: $*.$(ERR_SUFFIX) -> $(ERR_PATH)/$*.$(ERR_SUFFIX)"; \
        if [ -f $*.$(ERR_SUFFIX) ]; then $(MV) $*.$(ERR_SUFFIX) $(ERR_PATH)/$*.$(ERR_SUFFIX); fi;
    endef
else
    define MOVE_ERR_RULE
        $(ECHO) -n;
    endef
    ifeq ($(ERR_OUTPUT),PIPE)
        WHITESPACE :=
        REDIRECT_OUTPUT = > $(ERR_PATH)/$*.$(ERR_SUFFIX) 2>&1 $(WHITESPACE) # whitespace at the end to avoid errors with shell (qb)
    else
        ifneq ($(ERR_OUTPUT),FLAGS)
            $(error Variable ERR_OUTPUT in <Makefile> is not set correctly)
        endif
    endif
endif

##############################################################################
# Default targets and rules
##############################################################################

#-----------------------------------------------------------------------------
# A phony target is one that is not really the name of a file. It is just a
# name for some commands to be executed when you make an explicit request.
# There are two reasons to use a phony target: to avoid a conflict with a file
# of the same name, and to improve performance.
#-----------------------------------------------------------------------------
.PHONY: all clean compile depend default distclean cleanlibs inf force help rebuild library

.PHONY: pclint visual visual7 visual8 visual10 codewright del_codewright_pjt doxygen preprocess \
        slick resource qac qacinfo releasesheet version RESOURCE_NOT_SET size-all size-%.$(OBJ_SUFFIX) \
        quickbuild os copylibs

force: ;

all: inf \
     $(if $(USER_LINKER_COMMAND_FILE),,$(PROJECT_NAME).$(LNK_SUFFIX)) \
     $(PROJECT_NAME).$(BINARY_SUFFIX)
	@$(ECHO) ""; \
 $(ECHO) "...done!"
#-----------------------------------------------------------------------------
# prints information about used cpu/derivative
# -> from v_cfg.h
#-----------------------------------------------------------------------------
inf:
ifeq ($(V_CFG_DETECTED),1)
	@$(ECHO) "CPU type found in v_cfg.h -> $(CPU_TYPE)"; \
 $(ECHO);
else
	@$(ECHO) "CPU type (preselected) -> $(CPU_TYPE)"; \
 $(ECHO);
endif

#-----------------------------------------------------------------------------
# rebuild the whole project
#-----------------------------------------------------------------------------
rebuild:
	@if [ -n "$(QUICKBUILD)" ] ; then                                             \
    $(RM) $(OBJ_PATH)/*.$(OBJ_SUFFIX);                                                \
 else                                                                                 \
  "$(MAKE)" clean;                                  \
    if [ -f $(GENDATA_DIR_U)/BrsVInfo.h ] && [ -w $(GENDATA_DIR_U)/BrsVInfo.h ]; then \
      $(RM) $(GENDATA_DIR_U)/BrsVInfo.h;                                              \
    fi;                                                                               \
    if [ -f $(PROJECT_NAME).dep ] ; then                                              \
      $(RM) $(PROJECT_NAME).dep;                                                      \
    fi;                                                                               \
 fi;                                                                                  \
 "$(MAKE)" default


##############################################################################
# Quickbuild stuff
##############################################################################

QUICKBUILD_FILE = quickbuild.make

quickbuild:
	@if [ -f $(QUICKBUILD_FILE) ] ; then                                  \
    $(RM) $(QUICKBUILD_FILE);                                           \
  fi;                                                                   \
  $(ECHO) "Create file: $(QUICKBUILD_FILE)";                            \
  $(ECHO) ""    >> $(QUICKBUILD_FILE);                                  \
  "$(MAKE)" rebuild
  

ifeq ($(QUICKBUILD),1)
MAKEDEP_OFF=1
include $(QUICKBUILD_FILE)
endif

#-----------------------------------------------------------------------------
# prints versions of used tools
#-----------------------------------------------------------------------------
VERSION_DIR = $(subst / , ,$(subst ???,\ ,$(sort $(foreach DIR,          \
                $(filter-out                                             \
                  $(subst / , ,                                          \
                    $(subst \,/,$(subst \ ,???,                          \
                      $(call _toLower,$(COMPILER_INC))                   \
                      $(call _toLower,$(OBJ_PATH))                       \
                    ))                                                   \
                  ),                                                     \
                  $(subst / , ,                                          \
                    $(subst \,/,$(subst \ ,???,                          \
                      $(call _toLower,$(SUBDIRS))                        \
                    ))                                                   \
                    $(dir $(subst \,/,$(subst \ ,???,                    \
                      $(call _toLower,$(INCFILE_LIST))                   \
                    )))                                                  \
                  )                                                      \
                )                                                        \
              ,"$(DIR)"))))

VERSION_SCAN_DIRS = \
                 $(subst ???,\ ,                                         \
                   $(filter-out                                          \
                     $(subst / , ,                                       \
                       $(subst \,/,                                      \
                         $(subst \ ,???,                                 \
                           $(call _toLower, $(COMPILER_INC) $(OBJ_PATH)) \
                         )                                               \
                       )                                                 \
                     ),                                                  \
                     $(subst / , ,                                       \
                       $(subst \,/,                                      \
                         $(subst \ ,???,                                 \
                           $(call _toLower, $(SUBDIRS) $(INCDIR_LIST))   \
                         )                                               \
                       )                                                 \
                     )                                                   \
                   )                                                     \
                 )

VERSION_SCAN_FILES =                                                     \
        $(foreach FILE,                                                  \
            $(subst \ ,???,                                              \
              $(INCFILE_LIST_UNIX) $(filter-out $(VERSION_INFO_FILTEROUT_LST),$(SOURCES_UNIX))                       \
            ),                                                           \
            $(subst ???, ,"$(FILE)")                                     \
        )


#-----------------------------------------------------------------------------
# Defines used for releasesheet & resource
#-----------------------------------------------------------------------------

VERSION_INFO_FILE = $(subst \,/,$(GENTOOL_DIR)/version.info)

ifneq ($(shell if [ -f $(VERSION_INFO_FILE) ]; then $(ECHO) $(VERSION_INFO_FILE); fi),)
BLANK = #
FROM_VINFO_CBD        = $(firstword $(shell $(GAWK) -v IGNORECASE=1 "{gsub(/ /, \"_\")} /<CBD>/ {match(\$$0, /<CBD>(.*)<\/CBD>/, r);print r[1];}" $(VERSION_INFO_FILE)) UNKNOWN_CBD)
FROM_VINFO_SIP        = $(firstword $(shell $(GAWK) -v IGNORECASE=1 "{gsub(/ /, \"_\")} /<SIP>/ {match(\$$0, /<SIP>(.*)<\/SIP>/, r);print r[1];}" $(VERSION_INFO_FILE)) UNKNOWN_SIP)
FROM_VINFO_OEM        = $(firstword $(shell $(GAWK) -v IGNORECASE=1 "{gsub(/ /, \"_\")} /<OEM>/ {match(\$$0, /<OEM>(.*)<\/OEM>/, r);print r[1];}" $(VERSION_INFO_FILE)) UNKNOWN_OEM)
FROM_VINFO_SLP        = $(firstword $(shell $(GAWK) -v IGNORECASE=1 "{gsub(/ /, \"_\")} /<SLP>/ {match(\$$0, /<SLP>(.*)<\/SLP>/, r);print r[1];}" $(VERSION_INFO_FILE)) UNKNOWN_SLP)
FROM_VINFO_CONTROLLER = $(firstword $(shell $(GAWK) -v IGNORECASE=1 "{gsub(/ /, \"_\")} /<Controller>/ {match(\$$0, /<Controller>(.*)<\/Controller>/, r);print r[1];}" $(VERSION_INFO_FILE)) UNKNOWN_Controller)
FROM_VINFO_CANCELL    = $(firstword $(shell $(GAWK) -v IGNORECASE=1 "{gsub(/ /, \"_\")} /<CanCell>/ {match(\$$0, /<CanCell>(.*)<\/CanCell>/, r);print r[1];}" $(VERSION_INFO_FILE)) UNKNOWN_CanCell)
FROM_VINFO_COMPILER   = $(firstword $(shell $(GAWK) -v IGNORECASE=1 "{gsub(/ /, \"_\")} /<Compiler>/ {match(\$$0, /<Compiler>(.*)<\/Compiler>/, r);print r[1];}" $(VERSION_INFO_FILE)) UNKNOWN_Compiler)
# Specifies how the filenames for the releasesheet & resource info files are named.
RESOURCE_FILENAME     = $(FROM_VINFO_SLP).$(FROM_VINFO_OEM).$(FROM_VINFO_COMPILER).$(FROM_VINFO_CONTROLLER).$(FROM_VINFO_SIP).$(FROM_VINFO_CBD)
RESOURCE_TARGETDIR    = $(subst $(_OPEN_PAREN),,$(subst $(_CLOSE_PAREN),,$(RESOURCE_FILENAME)))
RESOURCE_COPYFILES    = ../CANdb/*.gny ../CANdb/*.arxml ../Config/*.gny ../Config/*.arxml
endif

#-----------------------------------------------------------------------------
# xml file which contains tool version and settings (processed by xslt processor)
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
makesupport.xml: force
	@$(ECHO) "Generating makesupport version information file (->$(subst /,\\,$@))";                       \
 $(ECHO) "<?xml version='1.0' encoding='UTF-8'?>"                                                        > $@; \
 $(ECHO) "<makesupport>"                                                                                >> $@; \
 $(ECHO) "<controller name='$(PLATFORM)' derivative='$(DERIVATIVE)' />"                                 >> $@; \
 $(ECHO) " <devtoolinfo>"                                                                               >> $@; \
 if [ -n '$(CC)' ]; then                                                                                       \
 $(ECHO) "    <tool type='Compiler' manufacturer='$(COMPILER_MANUFACTURER)'>"                           >> $@; \
 $(ECHO) "      <entry type='Version'>$(CC_VERSION_STRING)</entry>"                                     >> $@; \
 $(ECHO) "      <entry type='MemModelOptions'>$(CFLAGS_MEMORYMODEL)</entry>"                            >> $@; \
 $(ECHO) "      <entry type='OptimizationOptions'>$(CFLAGS_OPTIMIZATION)</entry>"                       >> $@; \
 $(ECHO) "      <entry type='AdditionalOptions'>$(CFLAGS_ADDITIONAL)</entry>"                           >> $@; \
 $(ECHOESC) $(foreach FILE,$(filter-out $(SOURCES_APPL_UNIX),$(SOURCES_UNIX)),                                 \
                $(if $(CFLAGS_$(call _toUpper,$(basename $(notdir $(FILE))))), \
                  "      <entry type='AdditionalOptions $(basename $(notdir $(FILE))).$(OBJ_SUFFIX)'> \
                     $(CFLAGS_$(call _toUpper,$(basename $(notdir $(FILE)))))</entry>" \
                  ,)\
               )                                                  >> $@; \
 $(ECHOESC) $(foreach FILE,$(filter-out $(SOURCES_APPL_UNIX),$(SOURCES_UNIX)),                                 \
                $(if $(FILTER_$(call _toUpper,$(basename $(notdir $(FILE))))), \
                  "      <entry type='FilteredOptions $(basename $(notdir $(FILE))).$(OBJ_SUFFIX)'> \
                     $(FILTER_$(call _toUpper,$(basename $(notdir $(FILE)))))</entry>" \
                  ,)\
               )                                                  >> $@; \
 $(ECHO) "      <entry type='WarningOptions'>$(CFLAGS_WARNING)</entry>"                                 >> $@; \
 $(ECHO) "    </tool>"                                                                                  >> $@; \
 fi;                                                                                                           \
 if [ -n '$(MA)' ]; then                                                                                       \
 $(ECHO) "    <tool type='MacroAssembler' manufacturer='$(COMPILER_MANUFACTURER)'>"                     >> $@; \
 $(ECHO) "      <entry type='Version'>$(MA_VERSION_STRING)</entry>"                                     >> $@; \
 $(ECHO) "      <entry type='MemModelOptions'>$(MAFLAGS_MEMORYMODEL)</entry>"                           >> $@; \
 $(ECHO) "      <entry type='OptimizationOptions'>$(MAFLAGS_OPTIMIZATION)</entry>"                      >> $@; \
 $(ECHO) "      <entry type='AdditionalOptions'>$(MAFLAGS_ADDITIONAL)</entry>"                          >> $@; \
 $(ECHO) "      <entry type='WarningOptions'>$(MAFLAGS_WARNING)</entry>"                                >> $@; \
 $(ECHO) "    </tool>"                                                                                  >> $@; \
 fi;                                                                                                           \
 if [ -n '$(AS)' ]; then                                                                                       \
 $(ECHO) "    <tool type='Assembler' manufacturer='$(COMPILER_MANUFACTURER)'>"                          >> $@; \
 $(ECHO) "      <entry type='Version'>$(AS_VERSION_STRING)</entry>"                                     >> $@; \
 $(ECHO) "      <entry type='MemModelOptions'>$(ASFLAGS_MEMORYMODEL)</entry>"                           >> $@; \
 $(ECHO) "      <entry type='OptimizationOptions'>$(ASFLAGS_OPTIMIZATION)</entry>"                      >> $@; \
 $(ECHO) "      <entry type='AdditionalOptions'>$(ASFLAGS_ADDITIONAL)</entry>"                          >> $@; \
 $(ECHO) "      <entry type='WarningOptions'>$(ASFLAGS_WARNING)</entry>"                                >> $@; \
 $(ECHO) "    </tool>"                                                                                  >> $@; \
 fi;                                                                                                           \
 if [ -n '$(LD)' ]; then                                                                                       \
 $(ECHO) "    <tool type='Linker' manufacturer='$(COMPILER_MANUFACTURER)'>"                             >> $@; \
 $(ECHO) "      <entry type='Version'>$(LD_VERSION_STRING)</entry>"                                     >> $@; \
 $(ECHO) "      <entry type='MemModelOptions'>$(LDFLAGS_MEMORYMODEL)</entry>"                           >> $@; \
 $(ECHO) "      <entry type='OptimizationOptions'>$(LDFLAGS_OPTIMIZATION)</entry>"                      >> $@; \
 $(ECHO) "      <entry type='AdditionalOptions'>$(LDFLAGS_ADDITIONAL)</entry>"                          >> $@; \
 $(ECHO) "      <entry type='WarningOptions'>$(LDFLAGS_WARNING)</entry>"                                >> $@; \
 $(ECHO) "    </tool>"                                                                                  >> $@; \
 fi;                                                                                                           \
 if [ -n '$(LB)' ]; then                                                                                       \
 $(ECHO) "    <tool type='Librarian'>"                                                                  >> $@; \
 $(ECHO) "      <entry type='Version'>$(LB_VERSION_STRING)</entry>"                                     >> $@; \
 $(ECHO) "      <entry type='Flags'>$(LBFLAGS)</entry>"                                                 >> $@; \
 $(ECHO) "    </tool>"                                                                                  >> $@; \
 fi;                                                                                                           \
 if [ -n '$(EXT_T1)' ]; then                                                                                   \
 $(ECHO) "    <tool type='ExternalTool1'>"                                                              >> $@; \
 $(ECHO) "      <entry type='Version'>$(EXT_T1_VERSION_STRING)</entry>"                                 >> $@; \
 $(ECHO) "      <entry type='Flags'>$(EXT_T1_FLAGS)</entry>"                                            >> $@; \
 $(ECHO) "    </tool>"                                                                                  >> $@; \
 fi;                                                                                                           \
 if [ -n '$(EXT_T2)' ]; then                                                                                   \
 $(ECHO) "    <tool type='ExternalTool2'>"                                                              >> $@; \
 $(ECHO) "      <entry type='Version'>$(EXT_T2_VERSION_STRING)</entry>"                                 >> $@; \
 $(ECHO) "      <entry type='Flags'>$(EXT_T2_FLAGS)</entry>"                                            >> $@; \
 $(ECHO) "    </tool>"                                                                                  >> $@; \
 fi;                                                                                                           \
 $(ECHO) " </devtoolinfo>"                                                                              >> $@; \
 $(ECHO) "</makesupport>"                                                                               >> $@; \
 $(ECHO) "...done";                                                                                            \
 $(ECHO) ;
endif
#-----------------------------------------------------------------------------
# releasesheet target
# VERSION_INFO_FILE is only set when Version.Info is found in /components directory of geny
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)

#-----------------------------------------------------------------------------
# Delivery Description target dir is $(ROOT)\_Doc for old deliveries(fbl), $(ROOT)\Doc for new 
# deliveries and $(LOG_PATH) if both doesn't exist.
#-----------------------------------------------------------------------------

DESC_PATH_ALT     = $(shell if [ -d $(subst \,/,$(ROOT)\_Doc) ] ;then  \
                            $(ECHO) '$(ROOT)\_Doc' ;                   \
                          else                                         \
                            $(ECHO) '$(LOG_PATH)'  ;                   \
                           fi)

DESC_PATH         = $(shell if [ -d $(subst \,/,$(ROOT)\Doc\DeliveryInformation) ] ;then   \
                            $(ECHO) '$(ROOT)\Doc\DeliveryInformation' ;                    \
                          else                                         \
                            $(ECHO) '$(DESC_PATH_ALT)'  ;              \
                           fi)

DESC_PATH_UNIX = $(subst ???,\ ,$(subst \,/,$(subst \ ,???,$(DESC_PATH))))

RELEASESHEET_FILENAME = DeliveryDescription_$(FROM_VINFO_CBD).html

deliverydescription: $(DESC_PATH_UNIX)/$(RELEASESHEET_FILENAME)

$(DESC_PATH_UNIX)/$(RELEASESHEET_FILENAME): makesupport.xml
	@if [ -d $(DESC_PATH_UNIX) ] ; then :;                                                                             \
   else                                                                                                                    \
     $(ECHO) "Generating directory $(DESC_PATH_UNIX)";                                                                          \
     $(MKDIR) $(DESC_PATH_UNIX);                                                                                                \
     $(ECHO) ;                                                                                                             \
   fi;                                                                                                                     \
   if [ -f $(VERSION_INFO_FILE) ]; then                                                                                    \
   if [ -f $(XSLT) ] ; then                                                                                                \
     $(CP) $(RELSHEET_XSL) script.xslt;                                                                                    \
     $(XSLT) -x script.xslt -i $(VERSION_INFO_FILE) -o $@ 1>/dev/null 2>/dev/null;                                         \
     $(ECHO) ;                                                                                                             \
     $(ECHO) "Generated file: $@";                                                                                         \
     $(RM) script.xslt;                                                                                                    \
   else                                                                                                                    \
     $(ECHO) "XSLT processor not found. Please update your _MakeSupport/cmd directory!";                                   \
   fi;                                                                                                                     \
 else                                                                                                                      \
   $(ECHO) "$(VERSION_INFO_FILE) could not be found! Please adjust GENTOOL_DIR variable in Makefile.project.part.defines"; \
 fi;                                                                                                                       \
 $(RM) makesupport.xml


MODULE_LIST_VERSION_MATCHING += COMMON_VDEF     \
                                CANGEN

MODULE_LIST_VERSION_IGNORE += CANGENEXE         \
                              VGEN_CANGEN       \
                              CC_GET_CCP
endif

#-----------------------------------------------------------------------------
# version target creates version.txt with tool and component versions
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
version: $(LOG_PATH)/$(PROJECT_NAME)_version.txt ;

$(LOG_PATH)/$(PROJECT_NAME)_version.txt: force
	@if [ -d $(LOG_PATH) ] ; then :;                                                                         \
 else                                                                                                           \
     $(ECHO) "Generating directory $(LOG_PATH)";                                                                \
     $(MKDIR) $(LOG_PATH);                                                                                      \
     $(ECHO) ;                                                                                                  \
 fi;                                                                                                            \
 $(ECHO) "Generating version information (->$(subst /,\\,$@))";                                                 \
 $(ECHO)                                                                                                  > $@; \
 $(ECHO) "------------------------------------------------------------";                                        \
 $(ECHO) "---------------------- Version Report ----------------------";                                        \
 $(ECHO) "------------------------------------------------------------";                                        \
 $(ECHO) "Make:";                                                                                               \
 "$(MAKE)" "-v";                                                                                                  \
 $(ECHO) ;                                                                                                      \
 if [ -n '$(CC)' ]; then                                                                                        \
   $(ECHO) "Compiler:"                                                                             | $(TEE) $@; \
   $(ECHO) '$(CC_VERSION_STRING)'                                                                  | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
   if [ -n '$(CFLAGS_OPTIMIZATION)' ]; then                                                                     \
     $(ECHO) "Compiler Flags (Optimization):"                                                      | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(CFLAGS_OPTIMIZATION))'                                                | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(CFLAGS_WARNING)' ]; then                                                                          \
     $(ECHO) "Compiler Flags (Warning):     "                                                      | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(CFLAGS_WARNING))'                                                     | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(CFLAGS_MEMORYMODEL)' ]; then                                                                      \
     $(ECHO) "Compiler Flags (MemoryModel):"                                                       | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(CFLAGS_MEMORYMODEL))'                                                 | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(CFLAGS_ADDITIONAL)' ]; then                                                                       \
     $(ECHO) "Compiler Flags (Additional):  "                                                      | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(CFLAGS_ADDITIONAL))'                                                  | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(CFLAGS_OPTIMIZATION)' ] ||                                                                        \
      [ -n '$(CFLAGS_WARNING)' ]      ||                                                                        \
      [ -n '$(CFLAGS_MEMORYMODEL)' ]  ||                                                                        \
      [ -n '$(CFLAGS_ADDITIONAL)' ]; then :;                                                                    \
   else                                                                                                         \
     $(ECHO) "Compiler Flags: "                                                                    | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(CFLAGS))'                                                             | $(TEE) $@; \
   fi;                                                                                                          \
   $(ECHO)                                                                                         | $(TEE) $@; \
 fi;                                                                                                            \
 if [ -n '$(MA)' ]; then                                                                                        \
   $(ECHO) "Macro Assembler:"                                                                      | $(TEE) $@; \
   $(ECHO) '$(MA_VERSION_STRING)'                                                                  | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
   if [ -n '$(MAFLAGS_OPTIMIZATION)' ]; then                                                                    \
     $(ECHO) "Macro Assembler Flags (Optimization):    "                                           | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(MAFLAGS_OPTIMIZATION))'                                               | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(MAFLAGS_WARNING)' ]; then                                                                         \
     $(ECHO) "Macro Assembler Flags (Warning):         "                                           | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(MAFLAGS_WARNING))'                                                    | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(MAFLAGS_MEMORYMODEL)' ]; then                                                                     \
     $(ECHO) "Macro Assembler Flags (MemoryModel):     "                                           | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(MAFLAGS_MEMORYMODEL))'                                                | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(MAFLAGS_ADDITIONAL)' ]; then                                                                      \
     $(ECHO) "Macro Assembler Flags (Additional):      "                                           | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(MAFLAGS_ADDITIONAL))'                                                 | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(MAFLAGS_OPTIMIZATION)' ] ||                                                                       \
      [ -n '$(MAFLAGS_WARNING)'       ||                                                                        \
      [ -n '$(MAFLAGS_MEMORYMODEL)' ]  ||                                                                       \
      [ -n '$(MAFLAGS_ADDITIONAL)' ]; then  :;                                                                  \
   else                                                                                                         \
     $(ECHO) "Macro Assembler Flags: "                                                             | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(MAFLAGS))'                                                            | $(TEE) $@; \
   fi;                                                                                                          \
   $(ECHO)                                                                                         | $(TEE) $@; \
 fi;                                                                                                            \
 if [ -n '$(AS)' ]; then                                                                                        \
   $(ECHO) "Assembler:"                                                                            | $(TEE) $@; \
   $(ECHO) '$(AS_VERSION_STRING)'                                                                  | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
   if [ -n '$(ASFLAGS_OPTIMIZATION)' ]; then                                                                    \
     $(ECHO) "Assembler Flags (Optimization):    "                                                 | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(ASFLAGS_OPTIMIZATION))'                                               | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(ASFLAGS_WARNING)' ]; then                                                                         \
     $(ECHO) "Assembler Flags (Warning):         "                                                 | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(ASFLAGS_WARNING))'                                                    | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(ASFLAGS_MEMORYMODEL)' ]; then                                                                     \
     $(ECHO) "Assembler Flags (MemoryModel):     "                                                 | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(ASFLAGS_MEMORYMODEL))'                                                | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(ASFLAGS_ADDITIONAL)' ]; then                                                                      \
     $(ECHO) "Assembler Flags (Additional):  "                                                     | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(ASFLAGS_ADDITIONAL))'                                                 | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(ASFLAGS_OPTIMIZATION)' ] ||                                                                       \
      [ -n '$(ASFLAGS_WARNING)'      ] ||                                                                       \
      [ -n '$(ASFLAGS_MEMORYMODEL)'  ] ||                                                                       \
      [ -n '$(ASFLAGS_ADDITIONAL)'   ]; then  :;                                                                \
   else                                                                                                         \
     $(ECHO) "Assembler Flags: "                                                                   | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(ASFLAGS))'                                                            | $(TEE) $@; \
   fi;                                                                                                          \
   $(ECHO)                                                                                         | $(TEE) $@; \
 fi;                                                                                                            \
 if [ -n '$(LD)' ]; then                                                                                        \
   $(ECHO) "Linker:"                                                                               | $(TEE) $@; \
   $(ECHO) '$(LD_VERSION_STRING)'                                                                  | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
   if [ -n '$(LDFLAGS_OPTIMIZATION)' ]; then                                                                    \
     $(ECHO) "Linker Flags (Optimization):"                                                        | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(LDFLAGS_OPTIMIZATION))'                                               | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(LDFLAGS_WARNING)' ]; then                                                                         \
     $(ECHO) "Linker Flags (Warning):     "                                                        | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(LDFLAGS_WARNING))'                                                    | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(LDFLAGS_MEMORYMODEL)' ]; then                                                                     \
     $(ECHO) "Linker Flags (MemoryModel): "                                                        | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(LDFLAGS_MEMORYMODEL))'                                                | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(LDFLAGS_ADDITIONAL)' ]; then                                                                      \
     $(ECHO) "Linker Flags (Additional):  "                                                        | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(LDFLAGS_ADDITIONAL))'                                                 | $(TEE) $@; \
   fi;                                                                                                          \
   if [ -n '$(LDFLAGS_OPTIMIZATION)' ] ||                                                                       \
      [ -n '$(LDFLAGS_WARNING)'      ] ||                                                                       \
      [ -n '$(LDFLAGS_MEMORYMODEL)'  ] ||                                                                       \
      [ -n '$(LDFLAGS_ADDITIONAL)'   ]; then :;                                                                 \
   else                                                                                                         \
     $(ECHO) "Linker Flags: "                                                                      | $(TEE) $@; \
     $(ECHO) '$(subst \,\\,$(LDFLAGS))'                                                            | $(TEE) $@; \
   fi;                                                                                                          \
   $(ECHO)                                                                                         | $(TEE) $@; \
 fi;                                                                                                            \
 if [ -n '$(LB)' ]; then                                                                                        \
   $(ECHO) "Librarian:"                                                                            | $(TEE) $@; \
   $(ECHO) '$(LB_VERSION_STRING)'                                                                  | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
   $(ECHO) "Librarian Flags: "                                                                     | $(TEE) $@; \
   $(ECHO) '$(subst \,\\,$(LBFLAGS))'                                                              | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
 fi;                                                                                                            \
 if [ -n   '$(EXT_T1)' ]; then                                                                                  \
   $(ECHO) "External Tool 1:       "                                                               | $(TEE) $@; \
   $(ECHO) '$(EXT_T1_VERSION_STRING)'                                                              | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
   $(ECHO) "External Tool 1 Flags: "                                                               | $(TEE) $@; \
   $(ECHO) '$(subst \,\\,$(EXT_T1_FLAGS))'                                                         | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
 fi;                                                                                                            \
 if [ -n '$(EXT_T2)' ]; then                                                                                    \
   $(ECHO) "External Tool 2:       "                                                               | $(TEE) $@; \
   $(ECHO) '$(EXT_T1_VERSION_STRING)'                                                              | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
   $(ECHO) "External Tool 2 Flags: "                                                               | $(TEE) $@; \
   $(ECHO) '$(subst \,\\,$(EXT_T2_FLAGS))'                                                         | $(TEE) $@; \
   $(ECHO)                                                                                         | $(TEE) $@; \
 fi;                                                                                                            \
 $(ECHO) "Extracting component versions";                                                                       \
 $(GAWK) -v IGNORECASE=1 --re-interval                                                                          \
         '                                                                                                      \
           FNR == 1 && FILENAME !~ /[ch](pp)?$$/ { nextfile; print "skip file " FILENAME; }                     \
           { gsub(/\/\*.*\*\//, "") }                                                                           \
           $$0      ~ /^[[:blank:]]*#[[:blank:]]*define/  &&                                                    \
           $$NF     ~ /^0x[0-9a-fA-F]{2,4}[uU]?[lL]?$$/   &&                                                    \
           $$(NF-1) ~ /^VGEN_DELIVERY_VERSION_BYTE_[0-9]$$/                                                     \
           {                                                                                                    \
             sub(/^0x/, "", $$NF);                                                                              \
             _genyVersionArray[$$(NF-1)] = $$NF;                                                                \
             _genyVersionDetectedAt = FILENAME ":" FNR;                                                         \
           }                                                                                                    \
           $$0      ~ /^[[:blank:]]*#[[:blank:]]*define/  &&                                                    \
           $$NF     ~ /^0x[0-9a-fA-F]{2,4}[uU]?[lL]?$$/   &&                                                    \
           $$(NF-1) ~ /_VERSION$$/                                                                              \
           {                                                                                                    \
             macro = $$(NF-1);                                                                                  \
             versionString = $$NF;                                                                              \
             sub(/^0x/, "", versionString);                                                                     \
             mainModule = "";                                                                                   \
             subModule  = "";                                                                                   \
             for(i = 1; i <= numModules; i++) {                                                                 \
               if (macro ~ "^" makefileModuleArray[i] &&                                                        \
                   length(makefileModuleArray[i]) > length(mainModule))                                         \
               {                                                                                                \
                 mainModule = makefileModuleArray[i];                                                           \
               }                                                                                                \
             }                                                                                                  \
             if(mainModule == "") {                                                                             \
               for(i = 1; i <= numIgnoreModule; i++) {                                                          \
                 if(macro ~ makefileModuleIgnoreArray[i]) {                                                     \
                   next;                                                                                        \
                 }                                                                                              \
               }                                                                                                \
               mainModule = macro;                                                                              \
               sub(/(_(RELEASE|BUGFIX))?_VERSION$$/, "", mainModule);                                           \
               subModule = "__UNKNOWN__";                                                                       \
             }                                                                                                  \
             if(subModule == "") {                                                                              \
               subModule = macro;                                                                               \
               sub("^" mainModule, "", subModule);                                                              \
               sub(/(_(RELEASE|BUGFIX))?_VERSION$$/, "", subModule);                                            \
               sub(/^_+/, "", subModule);                                                                       \
               sub(/^[ ]*$$/, "__STANDARD__", subModule);                                                       \
             }                                                                                                  \
             if(macro ~ /^(CANGENEXE|VGEN_CANGEN)/) {                                                           \
               subModule = "__CANGEN_DETECTION__";                                                              \
               mainModule = "CANGEN";                                                                           \
             }                                                                                                  \
             if(_vArr[mainModule, subModule] == "") {                                                           \
               _vArr[mainModule, subModule] = "xx.xx.xx";                                                       \
             }                                                                                                  \
             if(macro ~ /_(RELEASE|BUGFIX)_VERSION$$/) {                                                        \
               sub(/xx$$/, versionString, _vArr[mainModule, subModule]);                                        \
               if(_vArr[mainModule, subModule, "__FILENAME__"] == "") {                                         \
                 _vArr[mainModule, subModule, "__FILENAME__"] = FILENAME ":" FNR;                               \
               }                                                                                                \
             } else {                                                                                           \
               if(length(versionString) < 4) {                                                                  \
                 versionString = versionString "00";                                                            \
               }                                                                                                \
               _subsMade  = sub(/^xx/, substr(versionString, 1, 2), _vArr[mainModule, subModule]);              \
               if(_subsMade > 0) {                                                                              \
                 _subsMade += sub(/\.xx\./, "." substr(versionString, 3, 2) ".", _vArr[mainModule, subModule]); \
               }                                                                                                \
               if (_subsMade >= 2) {                                                                            \
                 _vArr[mainModule, subModule, "__FILENAME__"] = FILENAME ":" FNR;                               \
               }                                                                                                \
             }                                                                                                  \
             if(longestSubModuleLength < length(subModule) &&                                                   \
                subModule !~ /__(STANDARD|UNKNOWN|CANGEN_DETECTION)__/) {                                       \
               longestSubModuleLength = length(subModule);                                                      \
             }                                                                                                  \
             if(0)                                                                                              \
               printf "%-50s %-6s %30s : %-20s %s:%d\n", $$(NF-1), $$NF, mainModule, subModule, FILENAME, FNR;  \
           }                                                                                                    \
           func getFirstMatch(str, regex, _retStr) { match(str, regex, _retStr); return _retStr[1]; }           \
           BEGIN {                                                                                              \
             makefileModuleList = "$(MODULE_LIST_NEW) $(MODULE_LIST_COMMON) $(MODULE_LIST_VERSION_MATCHING)";   \
             numModules = split(makefileModuleList, makefileModuleArray, " ");                                  \
             numIgnoreModule = split("$(MODULE_LIST_VERSION_IGNORE)", makefileModuleIgnoreArray, " ");          \
           }                                                                                                    \
           END {                                                                                                \
             optimalWidth = longestSubModuleLength + length(" Version");                                        \
             outputFormat = "  %-" optimalWidth "s: %s (%s)\n";                                                 \
             print "";                                                                                          \
             print "####################";                                                                      \
             print "# Generation tool: #";                                                                      \
             print "####################";                                                                      \
             print "";                                                                                          \
             if(_genyVersionDetectedAt) {                                                                       \
               print "Geny Version:";                                                                           \
               printf "  ";                                                                                     \
               for(i = 0; i <= 9; i++) {                                                                        \
                 versionByte = _genyVersionArray["VGEN_DELIVERY_VERSION_BYTE_" i];                              \
                 if(versionByte) {                                                                              \
                   printf "%s", versionByte;                                                                    \
                 } else {                                                                                       \
                   printf "00";                                                                                 \
                 }                                                                                              \
                 if(i < 9) {                                                                                    \
                   printf ".";                                                                                  \
                 }                                                                                              \
               }                                                                                                \
               printf " (%s)\n", _genyVersionDetectedAt;                                                        \
             }                                                                                                  \
             _canGenKey = "CANGEN" SUBSEP "__CANGEN_DETECTION__";                                               \
             if(_vArr[_canGenKey]) {                                                                            \
               print "";                                                                                        \
               print "CanGen Version:";                                                                         \
               printf "  %s (%s)", _vArr[_canGenKey], _vArr[_canGenKey, "__FILENAME__"];                        \
             }                                                                                                  \
             arrCount = asorti(_vArr, _vArrIndSorted);                                                          \
             print "";                                                                                          \
             print "";                                                                                          \
             print "########################";                                                                  \
             print "# Standard components: #";                                                                  \
             print "########################";                                                                  \
             for(i = 1; i <= arrCount; i++) {                                                                   \
               _key = _vArrIndSorted[i];                                                                        \
               _val = _vArr[_key];                                                                              \
               split(_key, _keyArray, SUBSEP);                                                                  \
               mainModule = _keyArray[1];                                                                       \
               subModule  = _keyArray[2];                                                                       \
               filename   = _keyArray[3];                                                                       \
               if(filename != "") {                                                                             \
                 continue;                                                                                      \
               }                                                                                                \
               if(subModule ~ /__(UNKNOWN|CANGEN_DETECTION)__/) {                                               \
                 continue;                                                                                      \
               }                                                                                                \
               if(!(mainModule in _moduleHeaderPrinted)) {                                                      \
                 print "";                                                                                      \
                 print "# " mainModule ":";                                                                     \
                 _moduleHeaderPrinted[mainModule] = 1;                                                          \
               }                                                                                                \
               if(subModule == "__STANDARD__") {                                                                \
                 printf outputFormat, "Version", _val, _vArr[_key, "__FILENAME__"];                             \
               } else {                                                                                         \
                 printf outputFormat, subModule " Version", _val, _vArr[_key, "__FILENAME__"];                  \
               }                                                                                                \
             }                                                                                                  \
             print "";                                                                                          \
             print "#####################";                                                                     \
             print "# Other components: #";                                                                     \
             print "#####################";                                                                     \
             for(i = 1; i <= arrCount; i++) {                                                                   \
               _key = _vArrIndSorted[i];                                                                        \
               _val = _vArr[_key];                                                                              \
               split(_key, _keyArray, SUBSEP);                                                                  \
               mainModule = _keyArray[1];                                                                       \
               subModule  = _keyArray[2];                                                                       \
               filename   = _keyArray[3];                                                                       \
               if(filename != "") {                                                                             \
                 continue;                                                                                      \
               }                                                                                                \
               if(subModule != "__UNKNOWN__") {                                                                 \
                 continue;                                                                                      \
               }                                                                                                \
               print "";                                                                                        \
               print "# " mainModule ":";                                                                       \
               printf outputFormat, "Version", _val, _vArr[_key, "__FILENAME__"];                               \
             }                                                                                                  \
           }                                                                                                    \
         '                                                                                                      \
         $(VERSION_SCAN_FILES)                                                                     | $(TEE) $@; \
 $(ECHOESC) $(VERSION_INF)"\n"                                                                     | $(TEE) $@; \
 $(ECHO) "Configured derivative (looking in $(V_CFG_LOC)\v_cfg.h):"                                | $(TEE) $@; \
 $(ECHO) $(CPU_TYPE)                                                                               | $(TEE) $@; \
 $(ECHO)                                                                                           | $(TEE) $@; \
 $(ECHO) "License Information (looking in $(V_CFG_LOC)\v_cfg.h):"                                  | $(TEE) $@; \
 $(ECHO) -n "Serialnumber: "                                                                       | $(TEE) $@; \
 $(ECHO) $(SERIAL_NUMBER)                                                                          | $(TEE) $@; \
 $(ECHO)                                                                                           | $(TEE) $@; \
 $(ECHO) "CANtate MakeSupport:"                                                                    | $(TEE) $@; \
 $(ECHO) "MakeSupport Version $(MODULE_VERSION).$(NEWEST_SUB_VERSION).$(RELEASE_VERSION)"          | $(TEE) $@;
endif
#-----------------------------------------------------------------------------
# clean up err/lst/obj files
#-----------------------------------------------------------------------------
CLEAN_PATTERN_LIST =  $(LST_N_MAP_LIST_WOP) \
                      $(PROJECT_NAME).$(BINARY_SUFFIX) \
                      $(DEL_PATTERN_LIST)

CLEAN_PATTERN_LIST_UNIX   = $(subst \,/,$(CLEAN_PATTERN_LIST))

ifeq ($(QUICKBUILD),)
clean: $(MAKE_CLEAN_RULES)
	-@$(ECHO) "Deleting $(CLEAN_PATTERN_LIST)"; \
 for pattern in $(CLEAN_PATTERN_LIST_UNIX); do \
  $(RM) $$pattern 2>/dev/null;  \
 done; \
 $(ECHO)
endif

#-----------------------------------------------------------------------------
# clean up everything
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
distclean: del_codewright_pjt
	-@$(ECHO) "Deleting $(DEL_PATTERN_LIST)";                                                       \
 $(RM) $(DEL_PATTERN_LIST_UNIX) 2>/dev/null;                                                      \
 $(RRM) $(OBJ_PATH) $(ERR_PATH) $(LST_PATH) $(LOG_PATH) $(LIB_PATH);                              \
 $(ECHO) "Deleting $(DIST_CLEAN_LIST) in:";                                                       \
 for subdir in $(CLEANDIRS_UNIX); do                                                              \
     $(ECHO) "   $$subdir";                                                                       \
     for pattern in $(subst \,/,$(DIST_CLEAN_LIST)); do                                           \
         for file in $$subdir/$$pattern; do                                                       \
             if [ $$file != "./Makefile.project.part.defines" ] ; then                            \
                 if [ -f $$file ] && [ -w $$file ]; then                                          \
                     $(RM) $$file 2>/dev/null;                                                    \
                 fi;                                                                              \
             fi;                                                                                  \
         done;                                                                                    \
     done;                                                                                        \
 done;                                                                                            \
 $(ECHO)
endif
#-----------------------------------------------------------------------------
# link all objects together
#-----------------------------------------------------------------------------
LINK_RULE_Q=$(subst ",',$(subst \,/,$(LINK_RULE)))

$(PROJECT_NAME).$(BINARY_SUFFIX): %.$(BINARY_SUFFIX): $(OBJECTS_U) \
                                  Makefile   \
                                  $(MAKEFILE_CONFIG)   \
                                  Makefile.$(PLATFORM).$(COMPILER_MANUFACTURER).$(EMULATOR).make
	@$(ECHO);                                                                               \
 $(ECHO) "Linking files: ";                                                               \
 $(ECHO) "    $(OBJECTS)";                                                                \
 $(RM_ERR_FILE)                                                                           \
 if [ -n "$(QUICKBUILD)" ] ; then                                                         \
   if ( $(LINK_RULE_$(notdir $@)) ) ; then :;                                             \
       $(PRINT_ERR_TO_STDOUT)                                                             \
   else                                                                                   \
       $(PRINT_ERR_TO_STDOUT)                                                             \
       exit 1;                                                                            \
   fi;                                                                                    \
 else                                                                                     \
   if ( $(LINK_RULE) ) ; then                                                             \
       if [ -f $(QUICKBUILD_FILE) ] ; then                                                \
          $(ECHO) "  Creating $(QUICKBUILD_FILE) !";                                      \
          $(ECHO) "LINK_RULE_$(notdir $@) = $(LINK_RULE_Q)"      >> $(QUICKBUILD_FILE);     \
          $(ECHO) "OBJECTS = $(OBJECTS)"      >> $(QUICKBUILD_FILE);          \
       fi;                                                                                \
       $(PRINT_ERR_TO_STDOUT)                                                             \
   else                                                                                   \
       $(PRINT_ERR_TO_STDOUT)                                                             \
       exit 1;                                                                            \
   fi;                                                                                    \
 fi

#-----------------------------------------------------------------------------
# create project dependencies
#-----------------------------------------------------------------------------
ifeq ($(MAKEDEP_OFF),)
DEP_FILES = $(PREDEP)    \
            Makefile     \
            $(MAKEFILE_CONFIG) \
            Makefile.project.part.defines \
            $(MAKESUPPORT_DIR)/Global.Makefile.target.make.$(VERSION)
endif

ifeq ($(QUICKBUILD),)
$(PROJECT_NAME).dep: $(DEP_FILES)
	@$(MAKE_DEPEND_RULE)

depend:
	@$(MAKE_DEPEND_RULE)


define MAKE_DEPEND_RULE
    $(ECHO) "# this file is generated automatically by MakeSupport"                       \
        > $(PROJECT_NAME).dep;                                                            \
    $(ECHO) >> $(PROJECT_NAME).dep;                                                       \
    if [ -d $(LOG_PATH) ] ; then :;                                                       \
    else                                                                                  \
        $(ECHO) "Generating directory $(LOG_PATH)";                                       \
        $(MKDIR) $(LOG_PATH);                                                             \
        $(ECHO) ;                                                                         \
    fi;                                                                                   \
    if [ -f $(LOG_PATH)/makedep.txt ] ; then                                              \
        $(RM) $(LOG_PATH)/makedep.txt;                                                    \
    fi;                                                                                   \
    $(ECHO) Making dependencies for | $(TEE) $(LOG_PATH)/makedep.txt;                     \
    for FILE in $(DEPENDENCY_SOURCES_UNIX); do                                            \
        if [ -z "$(MKVERBOSE)" ] ; then                                                   \
            $(ECHO) "    $$FILE" |                                                        \
                $(TEE) $(LOG_PATH)/makedep.txt;                                           \
        else                                                                              \
            $(ECHO) "    $(MAKEDEPEND) $(CPPFLAGS) $(GCCINCLUDES) $$FILE" |               \
                $(TEE) $(LOG_PATH)/makedep.txt;                                           \
        fi;                                                                               \
        $(MAKEDEPEND) $(CPPFLAGS) $(GCCINCLUDES) $$FILE 2>makedep.tmp |                   \
            $(SED) '/\(.*\)\.o:\ \\/{;s/o:\ \\/o:/g;N;s/\n//g;};s/\(.*\)\.o:\ \(.*\.[cC][pP]\{0,1\}[pP]\{0,1\}\)\{0,1\}\(\ .*\)\{0,1\}/$(OBJ_PATH)\/\1.$(OBJ_SUFFIX):\ \2 $(MAKEFILE_CONFIG)\ \3/g'            \
                                                                  >> $(PROJECT_NAME).dep; \
        $(CAT) makedep.tmp >> $(LOG_PATH)/makedep.txt;                                    \
        $(CAT) makedep.tmp;                                                               \
        $(RM) makedep.tmp;                                                                \
    done;                                                                                 \
    $(ECHO)                                                       >> $(PROJECT_NAME).dep; \
    $(ECHO) "# Manual file dependencies"                          >> $(PROJECT_NAME).dep; \
    $(ECHOESC) $(foreach FILE,$(SOURCES_UNIX),                                            \
                   "$(if $(findstring $(notdir $(FILE)),$(DEPENDENCY_IGNORE_LIST)),\n$(OBJ_PATH)/$(basename $(notdir $(FILE))).$(OBJ_SUFFIX): $(FILE) force,)"     \
               )                                                  >> $(PROJECT_NAME).dep; \
    $(ECHO)                                                       >> $(PROJECT_NAME).dep; \
    $(ECHO) "# Assembler file dependencies"                       >> $(PROJECT_NAME).dep; \
    $(ECHOESC) $(foreach ASM,$(subst \,/,$(ASM_SOURCES)),                                 \
                   "\n$(OBJ_PATH)/$(basename $(notdir $(ASM))).$(OBJ_SUFFIX): $(ASM) $(MAKEFILE_CONFIG)"     \
               )                                                  >> $(PROJECT_NAME).dep; \
    $(ECHO)                                                       >> $(PROJECT_NAME).dep; \
    $(ECHO)                                                       >> $(PROJECT_NAME).dep; \
    $(ECHOESC) $(foreach LIB,$(sort $(BUILD_LIBS)),                                       \
                   "\n$(LIB): "                                                           \
                   "$(strip $(subst \,/,$(call libObjects,$(basename $(notdir $(LIB))))))"\
               )                                                  >> $(PROJECT_NAME).dep; \
    $(ECHO);
endef

DEPENDENCY_SOURCES_UNIX = $(foreach FILE,$(SOURCES_UNIX),                                 \
                              $(if $(findstring $(notdir $(FILE)),$(DEPENDENCY_IGNORE_LIST)),,$(FILE))  \
                            )

endif

#-----------------------------------------------------------------------------
# compiles all source files
#-----------------------------------------------------------------------------
compile: $(BUILD_OBJECTS_U)

#-----------------------------------------------------------------------------
# implicit rule to compile a single file
# (for targets obj_path/*.obj)
#-----------------------------------------------------------------------------
COMPILE_RULE_Q=$(subst ",',$(subst \,/,$(COMPILE_RULE)))
ASSEMBLE_RULE_Q=$(subst ",',$(subst \,/,$(ASSEMBLE_RULE)))

$(OBJ_PATH)/%.$(OBJ_SUFFIX):
	@for dir in $(DIR_LIST); do                                     \
     if [ -d $$dir ] ;                                                  \
         then :;                                                        \
     else                                                               \
         $(ECHO) "Generating directory $$dir";                          \
         $(MKDIR) $$dir;                                                \
         $(ECHO) ;                                                      \
     fi;                                                                \
 done;                                                                  \
 if [ -z "$<" ] ; then                                                  \
     $(ECHO) "Dependencies missing for $@";                             \
     $(ECHO) "Please run \"m depend\" or adjust the Makefile properly"; \
     exit 1;                                                            \
 else                                                                   \
     $(RM_ERR_FILE)                                                     \
     $(if $(findstring $(ASM_SUFFIX),$(suffix $<)),                     \
         $(ECHO) "Assembling file: $<";                                 \
         if [ -n "$(QUICKBUILD)" ] ; then                               \
            if ( $(ASSEMBLE_RULE_$(notdir $@)) ) ; then :;              \
                $(PRINT_ERR_TO_STDOUT)                                  \
                $(MOVE_OBJECT_RULE)                                     \
                $(MOVE_ERR_RULE)                                        \
            else                                                        \
                $(PRINT_ERR_TO_STDOUT)                                  \
                $(MOVE_ERR_RULE)                                        \
                exit 1;                                                 \
            fi;                                                         \
         else                                                           \
            if ( $(ASSEMBLE_RULE) ) ; then                              \
                if [ -f $(QUICKBUILD_FILE) ] ; then                     \
                  $(ECHO) "  Creating $(QUICKBUILD_FILE) !";         \
                  $(ECHO) "ASSEMBLE_RULE_$(notdir $@) = $(ASSEMBLE_RULE_Q)"    >> $(QUICKBUILD_FILE); \
                fi;                                                     \
                $(PRINT_ERR_TO_STDOUT)                                  \
                $(MOVE_OBJECT_RULE)                                     \
                $(MOVE_ERR_RULE)                                        \
            else                                                        \
                $(PRINT_ERR_TO_STDOUT)                                  \
                $(MOVE_ERR_RULE)                                        \
                exit 1;                                                 \
            fi;                                                         \
         fi;                                                            \
     ,                                                                  \
         $(ECHO) "Compiling file: $<";                                  \
         if [ -n "$(QUICKBUILD)" ] ; then                               \
	    test -n "$(COMPILE_RULE_$(notdir $@))" && xr="$(COMPILE_RULE_$(notdir $@))" || xr=false; \
	    if  ( $$xr ) ; then :;               \
                $(PRINT_ERR_TO_STDOUT)                                  \
                $(DECODE_RULE)                                          \
                $(MOVE_OBJECT_RULE)                                     \
                $(MOVE_ERR_RULE)                                        \
            else                                                        \
                $(PRINT_ERR_TO_STDOUT)                                  \
                $(MOVE_ERR_RULE)                                        \
                exit 1;                                                 \
            fi;                                                         \
         else                                                           \
            if ( $(COMPILE_RULE) ) ; then                               \
                if [ -f $(QUICKBUILD_FILE) ] ; then                     \
                  $(ECHO) "  Creating $(QUICKBUILD_FILE) !";         \
                  $(ECHO) "COMPILE_RULE_$(notdir $@) = $(COMPILE_RULE_Q)"      >> $(QUICKBUILD_FILE); \
                fi;                                                     \
                $(PRINT_ERR_TO_STDOUT)                                  \
                $(DECODE_RULE)                                          \
                $(MOVE_OBJECT_RULE)                                     \
                $(MOVE_ERR_RULE)                                        \
            else                                                        \
                $(PRINT_ERR_TO_STDOUT)                                  \
                $(MOVE_ERR_RULE)                                        \
                exit 1;                                                 \
            fi;                                                         \
         fi;                                                            \
     )                                                                  \
 fi;

#-----------------------------------------------------------------------------
# implicit rule to compile a single file
# (for targets obj_path\*.obj)
#-----------------------------------------------------------------------------
$(BUILD_OBJECTS): $(OBJ_PATH)\\%.$(OBJ_SUFFIX): $(OBJ_PATH)/%.$(OBJ_SUFFIX)

ifeq ($(MPPD_SUPPORT_LIBS),1)
#-----------------------------------------------------------------------------
# creates lib files
#-----------------------------------------------------------------------------

ifeq ($(QUICKBUILD),)
ifeq ($(USE_AUTOSAR_MAKE),1)
libtarget = $(sort $(foreach LIB_SRCS,$($(1)_FILES), \
                    $(ROOT)\$(GLOBAL_COMP_DIR)\$(dir $(LIB_SRCS))$(1).$(LIB_SUFFIX) \
                  ))

# Copying the Libs from lib/ to component folder
copylibs:
	@$(foreach LIB,$(LIBRARIES_TO_COPY), \
  $(ECHO) "Copying lib/$(LIB).$(LIB_SUFFIX) to $(call libtarget,$(LIB))"; \
  $(call _xcopy,lib/$(LIB).$(LIB_SUFFIX),$(dir $(call libtarget,$(LIB)))) \
  )


printlibs:
	@$(ECHO) "Available libraries:"; \
  $(foreach LIB,$(LIBRARIES_TO_BUILD), \
  $(ECHO) "$(LIB)"; \
  )
endif
endif

$(BUILD_LIBS_U): $(LIB_PATH)\\%.$(LIB_SUFFIX): $(LIB_PATH)/%.$(LIB_SUFFIX)
$(LIB_PATH)\\lib$(PROJECT_NAME).$(LIB_SUFFIX) : $(LIB_PATH)/lib$(PROJECT_NAME).$(LIB_SUFFIX)

$(LIB_PATH)/%.$(LIB_SUFFIX):
	@$(ECHO) "Creating lib: $@";             \
 if ( $(LIB_RULE) ) ; then :;                    \
     $(PRINT_ERR_TO_STDOUT)                      \
     $(MOVE_LIB_RULE)                            \
     $(MOVE_ERR_RULE)                            \
 else                                            \
     $(PRINT_ERR_TO_STDOUT)                      \
     $(MOVE_ERR_RULE)                            \
     exit 1;                                     \
 fi;

cleanlibs:
	@if [ -d $(LIB_PATH) ]; then                   \
     $(ECHO) "Deleting directory $(LIB_PATH)";   \
     $(RRM) $(LIB_PATH);                         \
 fi;                                             \
 $(MKDIR) $(LIB_PATH);                           

library: cleanlibs $(BUILD_LIBS_U)

endif

#-----------------------------------------------------------------------------
# display help of implemented targets
#-----------------------------------------------------------------------------
help:
	@$(ECHO) "Call 'm' instead of make! 'm.bat' is a batch which sets the necessary";         \
 $(ECHO) "environment and calls make with the given targets.";                              \
 $(ECHO) "'m' without any targets calls 'm default'.";                                      \
 $(ECHO);                                                                                   \
 $(ECHO) "usage:";
ifeq ($(QUICKBUILD),1)
	@$(ECHO) "q $(OBJ_PATH)\\file.$(OBJ_SUFFIX) ............ -- compile a single file";      \
 $(ECHO) "q compile ................ -- compile all source files";                          \
 $(ECHO) "q help ................... -- give help";                                         \
 $(ECHO) "q rebuild ................ -- make clean default";
else
	@$(ECHO) "m $(OBJ_PATH)\\file.$(OBJ_SUFFIX) ............. -- compile a single file";      \
 $(ECHO) "m $(LOG_PATH)\\file.c ............. -- generate single preprocessed file";        \
 $(ECHO) "m $(LOG_PATH)\\file_lint.txt ...... -- lint single file";                         \
 $(ECHO) "m default ................ -- build all targets";                                 \
 $(ECHO) "m clean .................. -- clean objects";                                     \
 $(ECHO) "m compile ................ -- compile all source files";                          \
 $(ECHO) "m depend ................. -- generate make dependencies";                        \
 $(ECHO) "m distclean .............. -- clean up for delivery";                             \
 $(ECHO) "m quickbuild ............. -- prepare quickbuild ";                               \
 $(ECHO) "m os ..................... -- starts oil generator";                              \
 $(ECHO) "m pclint ................. -- run pclint for the project with 'Global Wrap-up'";  \
 $(ECHO) "m help ................... -- give help";                                         \
 $(ECHO) "m version ................ -- display some version info";                         \
 $(ECHO) "m deliverydescription .... -- generate html deliverydescription";                 \
 $(ECHO) "m rebuild ................ -- make clean default";                                \
 $(ECHO) "m resource ............... -- generate resource information";                     \
 $(ECHO) "m preprocess ............. -- generate $(LOG_PATH)/file.c for whole project";     \
 $(ECHO) "m visual ................. -- create Visual C project file";                      \
 $(ECHO) "m visual7................. -- create Visual Studio .NET project file";            \
 $(ECHO) "m visual8................. -- create Visual Studio 2005 solution";                \
 $(ECHO) "m visual9................. -- create Visual Studio 2008 solution";                \
 $(ECHO) "m slick .................. -- create Visual Slick Edit project file";             \
 $(ECHO) "m codewright ............. -- create Codewright project space file";              \
 $(ECHO) "m doxygen ................ -- create doxygen documentation";                      \
 $(ECHO) "m qac .................... -- create QAC/MISRA check project files";              \
 $(ECHO) "m misra\*_report.txt ..... -- create QAC/MISRA report for *";                     \
 $(ECHO) "m misra\*_merge_reports .. -- create overall QAC/MISRA report for multiple configurations"; \
 $(ECHO) "m size-all ............... -- create size output for $(OBJ_PATH)\*.obj";          \
 $(ECHO) "m size-file.obj .......... -- create size output for $(OBJ_PATH)\file.obj";

ifeq ($(MPPD_SUPPORT_LIBS),1)
	@$(ECHO) "m $(LIB_PATH)\\libComponent.$(LIB_SUFFIX) ... -- generate a single lib file";   \
 $(ECHO) "m copylibs ............... -- Copy libs in component dir";                        \
 $(ECHO) "m library ................ -- generate lib files";
endif
ifeq ($(USE_AUTOSAR_MAKE),1)
	@$(ECHO) "m printlibs .............. -- show a list of available libs";
endif
ifneq ($(PLATFORM_HELP),)
	@$(ECHO) "----------- platform specific targets -----------";                           \
 $(PLATFORM_HELP)
endif

endif
#-----------------------------------------------------------------------------
# create osekos files
#-----------------------------------------------------------------------------
OIL_TARGET = $(patsubst %\,%,$(word 1, $(dir $(filter %\tcb.c, $(OSEKOS_DATA))) $(GENDATA_OS_DIR)))

ifeq ($(QUICKBUILD),)
ifeq ($(USE_AUTOSAR_MAKE),1)

ifneq ($(findstring 1,$(ZBRS_USED)),)
    ASROILDEP += Brs_asr.oil
endif

os: $(AUTOSAROS_DATA)
$(AUTOSAROS_DATA): $(SIMPLEOS_OIL)_ $(ASROILDEP)
	@$(ECHO) "generating OSEK_Sources (redirecting errors to $(ERR_PATH)\osekos.err)"; \
 if [ -d $(ERR_PATH) ] ;                                                                   \
 then :;                                                                                   \
 else                                                                                      \
     $(ECHO) "Generating directory $(ERR_PATH)";                                           \
     $(MKDIR) $(ERR_PATH);                                                                 \
 fi;                                                                                       \
 if [ -d $(GENDATA_OS_DIR_U) ] ;                                                           \
 then :;                                                                                   \
 else                                                                                      \
     $(ECHO) "Generating directory $(GENDATA_OS_DIR)";                                     \
     $(MKDIR) $(GENDATA_OS_DIR_U);                                                         \
 fi;                                                                                       \
 $(subst \,/, $(OIL_GEN) -r $(ERR_PATH)\osekos.err                                         \
     -x                                                                                    \
     -d $(OIL_TARGET)                                                                      \
     -g $(SIMPLEOS_OIL)_                                                                   \
 )

else

os: $(OSEKOS_DATA)

$(OSEKOS_DATA): $(SIMPLEOS_OIL)_
	@$(ECHO) "generating OSEK_Sources (redirecting errors to $(ERR_PATH)\osekos.err)"; \
 if [ -d $(ERR_PATH) ] ;                                                                   \
 then :;                                                                                   \
 else                                                                                      \
     $(ECHO) "Generating directory $(ERR_PATH)";                                           \
     $(MKDIR) $(ERR_PATH);                                                                 \
 fi;                                                                                       \
 if [ -d $(GENDATA_OS_DIR_U) ] ;                                                           \
 then :;                                                                                   \
 else                                                                                      \
     $(ECHO) "Generating directory $(GENDATA_OS_DIR)";                                     \
     $(MKDIR) $(GENDATA_OS_DIR_U);                                                         \
 fi;                                                                                       \
 $(subst \,/, $(OIL_GEN) -r $(ERR_PATH)\osekos.err                                         \
     -x                                                                                    \
     -d $(OIL_TARGET)                                                                      \
     -g $(SIMPLEOS_OIL)_                                                                   \
 )

endif

$(SIMPLEOS_OIL)_: $(SIMPLEOS_OIL) \
                  Makefile        \
                  $(MAKEFILE_CONFIG)
	@$(ECHO) "Patching $(SIMPLEOS_OIL)";
ifneq ($(OIL_PATTERN),) # All osCANs except CANoeOSEK Emu
	@$(call patchFile,$(SIMPLEOS_OIL),$(SIMPLEOS_OIL)_,OIL_PATTERN,OIL_)
else # CANoeOsek Emu
	@$(subst \,/,$(CP) $(SIMPLEOS_OIL) $(SIMPLEOS_OIL)_)
endif

endif
#-----------------------------------------------------------------------------
# pc-lint support
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
PCLINT_INC    = $(subst -I,-i,$(GCCINCLUDES))
PCLINT_SRC    = $(filter-out %.cpp,$(filter-out $(subst \,/,$(call toLower,PCLINT_EXCL)),$(call toLower,SOURCES_UNIX)))
PCLINT_LOGS_U = $(subst .cpp,_lint.txt,$(filter %.cpp,$(addprefix $(subst \,/,$(LOG_PATH))/,$(notdir $(PCLINT_SRC))))) \
                $(subst .c,_lint.txt,$(filter %.c,$(addprefix $(subst \,/,$(LOG_PATH))/,$(notdir $(PCLINT_SRC)))))
PCLINT_LOGS   = $(subst /,\,$(PCLINT_LOGS_U))
endif
#-----------------------------------------------------------------------------
# Generic PCLint options valid for all PSC projects
#-----------------------------------------------------------------------------
PCLINT_OPT_GENERIC =  +v          \
                      +ffn        \
                      -hb^3       \
                      -width(0)   \
                      -t2         \
                      -wlib(0)    \
                      +linebuf


pclint: pclintglobal
#pclint: pclint.lnt $(LOG_PATH) $(PCLINT_LOGS) //## Removed by Ms. If the project is linted the process is another one.

#-----------------------------------------------------------------------------
# implicit rule to lint a single file
# (for targets log_path\*_lint.txt)
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
$(subst /,\,$(PCLINT_LOGS)) : $(LOG_PATH)\\%_lint.txt: $(LOG_PATH)/%_lint.txt
$(LOG_PATH)/%_lint.txt: pclint.lnt force
	@$(ECHO) "Linting"                                                                        \
     $(firstword $(foreach FILE,$(filter %$*.c,$(subst .C,.c,$(PCLINT_SRC))),                     \
         $(if $(filter-out $*.c,$(notdir $(FILE))),,$(FILE))                                      \
     ))                                                                                           \
     "(-> $@)";                                                                                   \
 $(ECHO) > $(LOG_PATH)/$*_lint.txt;                                                               \
 if [ -n "$(MKVERBOSE)" ] ; then                                                                  \
     $(ECHO) $(PCLINT_UNIX)                                                                       \
         +v                                                                                       \
         $(subst ???, ,$(addprefix -d,$(foreach ITEM,$(subst \ ,???,$(PCLINT_DEF)),\"$(ITEM)\"))) \
         $(PCLINT_INC)                                                                            \
         $(PCLINT_CMD) -u                                                                         \
         $(firstword $(foreach FILE,$(filter %$*.c,$(subst .C,.c,$(PCLINT_SRC))),                 \
             $(if $(filter-out $*.c,$(notdir $(FILE))),,$(FILE))                                  \
         ));                                                                                      \
 fi;                                                                                              \
 if [ -z "$(CW_ACTIVE)" ] ; then                                                                  \
     $(PCLINT_UNIX)                                                                               \
         +v                                                                                       \
         $(subst ???, ,$(addprefix -d,$(foreach ITEM,$(subst \ ,???,$(PCLINT_DEF)),"$(ITEM)")))   \
         $(PCLINT_INC)                                                                            \
         $(PCLINT_CMD) -u                                                                         \
         $(firstword $(foreach FILE,$(filter %$*.c,$(subst .C,.c,$(PCLINT_SRC))),                 \
             $(if $(filter-out $*.c,$(notdir $(FILE))),,$(FILE))                                  \
         )) 2>/dev/null >> $@;                                                                    \
 else                                                                                             \
     $(PCLINT_UNIX)                                                                               \
         +v                                                                                       \
         $(subst ???, ,$(addprefix -d,$(foreach ITEM,$(subst \ ,???,$(PCLINT_DEF)),"$(ITEM)")))   \
         $(PCLINT_INC)                                                                            \
         $(PCLINT_CMD) -u                                                                         \
         $(firstword $(foreach FILE,$(filter %$*.c,$(subst .C,.c,$(PCLINT_SRC))),                 \
             $(if $(filter-out $*.c,$(notdir $(FILE))),,$(FILE))                                  \
         )) 2>/dev/null | $(TEE) $@;                                                              \
 fi

pclintglobal: pclint.lnt force
	@$(ECHO) "Linting the complete project, includes (Global Wrap-up)";                             \
  $(ECHO) > $(LOG_PATH)/$(PROJECT_NAME)_lint.txt;                                                 \
 if [ -n "$(MKVERBOSE)" ] ; then                                                                  \
     $(ECHO) $(PCLINT_UNIX)                                                                       \
         +v                                                                                       \
         $(subst ???, ,$(addprefix -d,$(foreach ITEM,$(subst \ ,???,$(PCLINT_DEF)),\"$(ITEM)\"))) \
         $(PCLINT_INC)                                                                            \
         $(PCLINT_CMD)                                                                            \
         $(firstword $(foreach FILE,$(filter %$*.c,$(subst .C,.c,$(PCLINT_SRC))),                 \
             $(if $(filter-out $*.c,$(notdir $(FILE))),,$(FILE))                                  \
         ));                                                                                      \
 fi;                                                                                              \
 if [ -z "$(CW_ACTIVE)" ] ; then                                                                  \
     $(PCLINT_UNIX)                                                                               \
         +v                                                                                       \
         $(subst ???, ,$(addprefix -d,$(foreach ITEM,$(subst \ ,???,$(PCLINT_DEF)),"$(ITEM)")))   \
         $(PCLINT_INC)                                                                            \
         $(PCLINT_CMD)                                                                            \
         $(foreach FILE, $(subst .C,.c,$(PCLINT_SRC)), $(FILE))                                   \
         2>/dev/null >> $(LOG_PATH)/$(PROJECT_NAME)_lint.txt;                                     \
 else                                                                                             \
     $(PCLINT_UNIX)                                                                               \
         +v                                                                                       \
         $(subst ???, ,$(addprefix -d,$(foreach ITEM,$(subst \ ,???,$(PCLINT_DEF)),"$(ITEM)")))   \
         $(PCLINT_INC)                                                                            \
         $(PCLINT_CMD)                                                                            \
         $(foreach FILE, $(subst .C,.c,$(PCLINT_SRC)), $(FILE))                                   \
         2>/dev/null | $(TEE) $(LOG_PATH)/$(PROJECT_NAME)_lint.txt;                               \
 fi


pclint.lnt:
	@$(ECHO) "Creating $@";                                                                     \
  $(ECHO) "// this file is generated automatically by MakeSupport"                            > $@; \
  $(ECHOESC) $(subst ???, ,$(foreach OPT,$(subst \ ,???,$(PCLINT_OPT_GENERIC)),'\n$(OPT)'))  >> $@; \
  $(ECHOESC) $(subst ???, ,$(foreach OPT,$(subst \ ,???,$(PCLINT_OPT_SPECIFIC)),'\n$(OPT)')) >> $@; \
  $(ECHO) "...done";                                                                                \
  $(ECHO) "";
endif
#-----------------------------------------------------------------------------
# generate preprocess files
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)

PREPROCESS_FILES = $(addprefix $(LOG_PATH)/,$(notdir $(filter-out %.cpp,$(call _toLower,$(SOURCES_UNIX)))))

preprocess: $(LOG_PATH) $(PREPROCESS_FILES)

$(subst /,\,$(PREPROCESS_FILES)) : $(LOG_PATH)\\%.c: $(LOG_PATH)/%.c
$(LOG_PATH)/%.c: force
	@$(ECHO) "preprocessing"                                                 \
 $(foreach FILE,$(filter %$*.c,$(subst .C,.c,$(call _toLower,$(SOURCES_UNIX)))), \
     $(if $(filter-out $*.c,$(notdir $(FILE))),,$(FILE))                         \
 )                                                                               \
 "(-> $@)";                                                                      \
 $(MAKEDEPEND) -P -C $(filter-out -M,$(CPPFLAGS)) $(GCCINCLUDES)                 \
 $(foreach FILE,$(filter %$*.c,$(subst .C,.c,$(call _toLower,$(SOURCES_UNIX)))), \
     $(if $(filter-out $*.c,$(notdir $(FILE))),,$(FILE))                         \
 ) -o $@;
endif
##############################################################################
# File generation
##############################################################################
ifeq ($(QUICKBUILD),)

ifeq ($(V_CFG_DETECTED),1)
C_COMP_DEFINE    = $(subst _, ,$(shell $(SED) -n 's/^[ \t]*\#define[ \t]*C_COMP_\([_A-Z0-9]*\)/\1/p' $(V_CFG);))
SERIAL_NUMBER    = $(shell $(SED) -n 's/[\*]\?[\ \t-]\{1,\}\(Serialnumber\|Serial\ Number\):[\ \t]\{1,\}\(.*\)/\2/p' $(V_CFG);)
else
C_COMP_DEFINE    = N/A
SERIAL_NUMBER    = N/A
endif

C_COMPILER_DEF   = $(firstword $(C_COMP_DEFINE))
C_CONTROLLER_DEF = $(filter-out $(firstword $(C_COMP_DEFINE)),$(C_COMP_DEFINE))


_CC_LC = $(strip $(if $(CC_LC),$(CC_LC),5))
_MA_LC = $(strip $(if $(MA_LC),$(MA_LC),5))
_AS_LC = $(strip $(if $(AS_LC),$(AS_LC),5))
_LD_LC = $(strip $(if $(LD_LC),$(LD_LC),5))
_LB_LC = $(strip $(if $(LB_LC),$(LB_LC),5))

_CC_OFF = $(strip $(if $(CC_OFF),$(CC_OFF),1))
_MA_OFF = $(strip $(if $(MA_OFF),$(MA_OFF),1))
_AS_OFF = $(strip $(if $(AS_OFF),$(AS_OFF),1))
_LD_OFF = $(strip $(if $(LD_OFF),$(LD_OFF),1))
_LB_OFF = $(strip $(if $(LB_OFF),$(LB_OFF),1))

CC_VERSION_STRING     = $(strip $(shell $(CC_ENV_U) $(YES) $(RR_YES) | $(if $(CC),$(CC_U),$(ECHO))  $(CVERSION) 2>&1 | $(SED) $(_CC_OFF),$(_CC_LC)!d))
MA_VERSION_STRING     = $(strip $(shell $(MA_ENV_U) $(YES) $(MA_YES) | $(if $(MA),$(MA_U),$(ECHO)) $(MAVERSION) 2>&1 | $(SED) $(_MA_OFF),$(_MA_LC)!d))
AS_VERSION_STRING     = $(strip $(shell $(AS_ENV_U) $(YES) $(AS_YES) | $(if $(AS),$(AS_U),$(ECHO)) $(ASVERSION) 2>&1 | $(SED) $(_AS_OFF),$(_AS_LC)!d))
LD_VERSION_STRING     = $(strip $(shell $(LD_ENV_U) $(YES) $(LD_YES) | $(if $(LD),$(LD_U),$(ECHO)) $(LDVERSION) 2>&1 | $(SED) $(_LD_OFF),$(_LD_LC)!d))
LB_VERSION_STRING     = $(strip $(shell $(LB_ENV_U) $(YES) $(LB_YES) | $(if $(LB),$(LB_U),$(ECHO)) $(LBVERSION) 2>&1 | $(SED) $(_LB_OFF),$(_LB_LC)!d))

EXT_T1_VERSION_STRING = $(strip $(shell $(EXT_T1_ENV_U) $(YES) | $(if $(EXT_T1),$(EXT_T1_U),$(ECHO)) $(EXT_T1_VERSION) 2>&1 | $(SED) $(strip $(if $(EXT_T1_LC),$(EXT_T1_LC),5))q))
EXT_T2_VERSION_STRING = $(strip $(shell $(EXT_T2_ENV_U) $(YES) | $(if $(EXT_T2),$(EXT_T2_U),$(ECHO)) $(EXT_T2_VERSION) 2>&1 | $(SED) $(strip $(if $(EXT_T2_LC),$(EXT_T2_LC),5))q))

$(GENDATA_DIR)\BrsVInfo.h: $(GENDATA_DIR_U)/BrsVInfo.h ;
$(GENDATA_DIR_U)/BrsVInfo.h: Makefile     \
                           $(MAKESUPPORT_DIR)/Global.Makefile.target.make.$(VERSION)
	@$(ECHO) "Generating $@";                                                               \
 if [ -w $(GENDATA_DIR_U)/BrsVInfo.h ] || [ ! -f $(GENDATA_DIR_U)/BrsVInfo.h ]; then            \
     $(ECHO) "/* This file is generated automatically by MakeSupport */"                  > $@; \
     $(ECHO) "#ifndef __BRSVINFO_H"                                                      >> $@; \
     $(ECHO) "#define __BRSVINFO_H"                                                      >> $@; \
     $(ECHO)                                                                             >> $@; \
     $(ECHO) "#ifndef _BRS_V_INFO_VALID"                                                 >> $@; \
     $(ECHO) "  #error Include of BrsVInfo.h is only allowed in context of BrsCtrl.c"    >> $@; \
     $(ECHO) "#endif"                                                                    >> $@; \
     $(ECHO)                                                                             >> $@; \
     $(ECHO) "#ifndef _BRS_ENABLE_FLAG_ACCESS_"                                          >> $@; \
     $(ECHO) "  #define _BRS_ENABLE_FLAG_ACCESS_"                                        >> $@; \
     $(ECHO) "#endif"                                                                    >> $@; \
     $(ECHO)                                                                             >> $@; \
     $(ECHO) "#if defined ( C_COMP_IAR_M16C )"                                           >> $@; \
     $(ECHO) "  #if defined ( _NEAR_ )"                                                  >> $@; \
     $(ECHO) "  /* Set const data to const segment, don\'t initialize */"                >> $@; \
     $(ECHO) "  #pragma memory=constseg(CONST_DATA) :far"                                >> $@; \
     $(ECHO) "  #endif"                                                                  >> $@; \
     $(ECHO) "#endif"                                                                    >> $@; \
     $(ECHO)                                                                             >> $@; \
     if [ -n '$(CC)' ]; then $(ECHO) "#define BRS_ENABLE_COMPILER_VERSION"           >> $@; fi; \
     if [ -n '$(MA)' ]; then $(ECHO) "#define BRS_ENABLE_MACROASSEMBLER_VERSION"     >> $@; fi; \
     if [ -n '$(AS)' ]; then $(ECHO) "#define BRS_ENABLE_ASSEMBLER_VERSION"          >> $@; fi; \
     if [ -n '$(LD)' ]; then $(ECHO) "#define BRS_ENABLE_LINKER_VERSION"             >> $@; fi; \
     if [ -n '$(LB)' ]; then $(ECHO) "#define BRS_ENABLE_LIBRARIAN_VERSION"          >> $@; fi; \
     if [ -n '$(EXT_T1)' ]; then $(ECHO) "#define BRS_ENABLE_EXT_T1_VERSION"         >> $@; fi; \
     if [ -n '$(EXT_T2)' ]; then $(ECHO) "#define BRS_ENABLE_EXT_T2_VERSION"         >> $@; fi; \
     $(ECHO)                                                                             >> $@; \
     $(ECHO) "#if defined ( BRS_ENABLE_TOOL_VERSIONINFO )"                               >> $@; \
     $(ECHO)                                                                             >> $@; \
     if [ -n '$(CC)' ]; then                                                                    \
         $(ECHO) "    retrieving Compiler Version";                                             \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsCompilerVersion[] ='                 \
                        '"$(subst \,\\,$(CC_VERSION_STRING))";'                          >> $@; \
         $(ECHO) "#if defined ( BRS_ENABLE_FLAG_ACCESS )"                                >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsCompilerOptimization[] ='            \
                        '"$(subst ",\",$(subst \,\\,$(CFLAGS_OPTIMIZATION)))";'          >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsCompilerWarning[] ='                 \
                        '"$(subst ",\",$(subst \,\\,$(CFLAGS_WARNING)))";'               >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsCompilerMemoryModel[] ='             \
                        '"$(subst ",\",$(subst \,\\,$(CFLAGS_MEMORYMODEL)))";'           >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsCompilerAdditional[] ='              \
                        '"$(subst ",\",$(subst \,\\,$(CFLAGS_ADDITIONAL)))";'            >> $@; \
         $(ECHO) "#endif /* defined ( BRS_ENABLE_FLAG_ACCESS ) */"                       >> $@; \
         $(ECHO)                                                                         >> $@; \
     fi;                                                                                        \
     if [ -n '$(MA)' ]; then                                                                    \
         $(ECHO) "    retrieving Macro Assembler Version";                                      \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsMacroAssemblerVersion[] ='           \
                        '"$(subst \,\\,$(MA_VERSION_STRING))";'                          >> $@; \
         $(ECHO) "#if defined ( BRS_ENABLE_FLAG_ACCESS )"                                >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsMacroAssemblerOptimization[] ='      \
                        '"$(subst ",\",$(subst \,\\,$(MAFLAGS_OPTIMIZATION)))";'         >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsMacroAssemblerWarning[] ='           \
                        '"$(subst ",\",$(subst \,\\,$(MAFLAGS_WARNING)))";'              >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsMacroAssemblerMemoryModel[] ='       \
                        '"$(subst ",\",$(subst \,\\,$(MAFLAGS_MEMORYMODEL)))";'          >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsMacroAssemblerAdditional[] ='        \
                        '"$(subst ",\",$(subst \,\\,$(MAFLAGS_ADDITIONAL)))";'           >> $@; \
         $(ECHO) "#endif /* defined ( BRS_ENABLE_FLAG_ACCESS ) */"                       >> $@; \
         $(ECHO)                                                                         >> $@; \
     fi;                                                                                        \
     if [ -n '$(AS)' ]; then                                                                    \
         $(ECHO) "    retrieving Assembler Version";                                            \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsAssemblerVersion[] ='                \
                        '"$(subst \,\\,$(AS_VERSION_STRING))";'                          >> $@; \
         $(ECHO) "#if defined ( BRS_ENABLE_FLAG_ACCESS )"                                >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsAssemblerOptimization[] ='           \
                        '"$(subst ",\",$(subst \,\\,$(ASFLAGS_OPTIMIZATION)))";'         >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsAssemblerWarning[] ='                \
                        '"$(subst ",\",$(subst \,\\,$(ASFLAGS_WARNING)))";'              >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsAssemblerMemoryModel[] ='            \
                        '"$(subst ",\",$(subst \,\\,$(ASFLAGS_MEMORYMODEL)))";'          >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsAssemblerAdditional[] ='             \
                        '"$(subst ",\",$(subst \,\\,$(ASFLAGS_ADDITIONAL)))";'           >> $@; \
         $(ECHO) "#endif /* defined ( BRS_ENABLE_FLAG_ACCESS ) */"                       >> $@; \
         $(ECHO)                                                                         >> $@; \
     fi;                                                                                        \
     if [ -n '$(LD)' ]; then                                                                    \
         $(ECHO) "    retrieving Linker Version";                                               \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsLinkerVersion[] ='                   \
                        '"$(subst \,\\,$(LD_VERSION_STRING))";'                          >> $@; \
         $(ECHO) "#if defined ( BRS_ENABLE_FLAG_ACCESS )"                                >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsLinkerOptimization[] ='              \
                        '"$(subst ",\",$(subst \,\\,$(LDFLAGS_OPTIMIZATION)))";'         >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsLinkerWarning[] ='                   \
                        '"$(subst ",\",$(subst \,\\,$(LDFLAGS_WARNING)))";'              >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsLinkerMemoryModel[] ='               \
                        '"$(subst ",\",$(subst \,\\,$(LDFLAGS_MEMORYMODEL)))";'          >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsLinkerAdditional[] ='                \
                        '"$(subst ",\",$(subst \,\\,$(LDFLAGS_ADDITIONAL)))";'           >> $@; \
         $(ECHO) "#endif /* defined ( BRS_ENABLE_FLAG_ACCESS ) */"                       >> $@; \
         $(ECHO)                                                                         >> $@; \
     fi;                                                                                        \
     if [ -n '$(LB)' ]; then                                                                    \
         $(ECHO) "    retrieving Librarian Version";                                            \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsLibrarianVersion[] ='                \
                        '"$(subst \,\\,$(LB_VERSION_STRING))";'                          >> $@; \
         $(ECHO) "#if defined ( BRS_ENABLE_FLAG_ACCESS )"                                >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsLibrarianParameter[] ='              \
                        '"$(subst ",\",$(subst \,\\,$(LBFLAGS)))";'                      >> $@; \
         $(ECHO) "#endif /* defined ( BRS_ENABLE_FLAG_ACCESS ) */"                       >> $@; \
         $(ECHO)                                                                         >> $@; \
     fi;                                                                                        \
     if [ -n '$(EXT_T1)' ]; then                                                                \
         $(ECHO) "    retrieving External Tool 1 Version";                                      \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsExtTool1Version[] ='                 \
                        '"$(subst \,\\,$(EXT_T1_VERSION_STRING))";'                      >> $@; \
         $(ECHO) "#if defined ( BRS_ENABLE_FLAG_ACCESS )"                                >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsExtTool1Parameter[] ='               \
                        '"$(subst ",\",$(subst \,\\,$(EXT_T1_FLAGS)))";'                 >> $@; \
         $(ECHO) "#endif /* defined ( BRS_ENABLE_FLAG_ACCESS ) */"                       >> $@; \
         $(ECHO)                                                                         >> $@; \
     fi;                                                                                        \
     if [ -n '$(EXT_T2)' ]; then                                                                \
         $(ECHO) "    retrieving External Tool 2 Version";                                      \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsExtTool2Version[] ='                 \
                        '"$(subst \,\\,$(EXT_T2_VERSION_STRING))";'                      >> $@; \
         $(ECHO) "#if defined ( BRS_ENABLE_FLAG_ACCESS )"                                >> $@; \
         $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsExtTool2Parameter[] ='               \
                        '"$(subst ",\",$(subst \,\\,$(EXT_T2_FLAGS)))";'                 >> $@; \
         $(ECHO) "#endif /* defined ( BRS_ENABLE_FLAG_ACCESS ) */"                       >> $@; \
         $(ECHO)                                                                         >> $@; \
     fi;                                                                                        \
     $(ECHO) "#endif /* defined ( BRS_ENABLE_TOOL_VERSIONINFO ) */"                      >> $@; \
     $(ECHO)                                                                             >> $@; \
     $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsCompilerDef[]   = "$(C_COMPILER_DEF)";'  \
                                                                                         >> $@; \
     $(ECHO) 'V_MEMROM0 V_MEMROM1 vsint8 V_MEMROM2 kBrsControllerDef[] = "$(C_CONTROLLER_DEF)";'\
                                                                                         >> $@; \
     $(ECHO)                                                                             >> $@; \
     $(ECHO) "#if defined ( C_COMP_IAR_M16C )"                                           >> $@; \
     $(ECHO) "  #if defined ( _NEAR_ )"                                                  >> $@; \
     $(ECHO) "  /* Normal segment usage */"                                              >> $@; \
     $(ECHO) "  #pragma memory=default"                                                  >> $@; \
     $(ECHO) "  #endif"                                                                  >> $@; \
     $(ECHO) "#endif"                                                                    >> $@; \
     $(ECHO)                                                                             >> $@; \
     $(ECHO) "#endif /* __BRSVINFO_H */"                                                 >> $@; \
 else                                                                                           \
     $(ECHO) ;                                                                                  \
     $(ECHO) "Couldn't generate BrsVInfo.h.";                                                   \
     $(ECHO) "File is write protected!";                                                        \
     $(ECHO) ;                                                                                  \
 fi;                                                                                            \
 $(ECHO) "...done";                                                                             \
 $(ECHO) ;

endif
##############################################################################
# CodeWright Workarounds
##############################################################################

ifneq ($(CW_ACTIVE),)
    #-----------------------------------------------------------------------------
    # implicit rule to lint a single file (workaround for CodeWright)
    # as CodeWright does not have a filename component macro for only the basename
    # of a file without the path and without the suffix
    # (for targets log_path\*.c_lint.txt)
    #-----------------------------------------------------------------------------
    $(subst _lint.txt,.c_lint.txt,$(subst /,\,$(PCLINT_LOGS))) : $(LOG_PATH)\\%.c_lint.txt: $(LOG_PATH)/%_lint.txt

    #-----------------------------------------------------------------------------
    # implicit rule to compile a single file (workaround for CodeWright)
    # as CodeWright does not have a filename component macro for only the basename
    # of a file without the path and without the suffix
    # (for targets log_path\*.c_.obj)
    #-----------------------------------------------------------------------------
    $(subst .$(OBJ_SUFFIX),.c.$(OBJ_SUFFIX),$(OBJECTS)): $(OBJ_PATH)\\%.c.$(OBJ_SUFFIX): $(OBJ_PATH)/%.$(OBJ_SUFFIX)
    $(subst .$(OBJ_SUFFIX),.$(ASM_SUFFIX).$(OBJ_SUFFIX),$(OBJECTS)): $(OBJ_PATH)\\%.$(ASM_SUFFIX).$(OBJ_SUFFIX): $(OBJ_PATH)/%.$(OBJ_SUFFIX)
endif

##############################################################################
# Project File Generation
##############################################################################

#-----------------------------------------------------------------------------
# Default values for lst and error file suffix
#-----------------------------------------------------------------------------
ifeq ($(LST_SUFFIX_LIST),)
    LST_SUFFIX_LIST = lst
endif
ifeq ($(ERR_SUFFIX_LIST),)
    ERR_SUFFIX_LIST = err
endif

#-----------------------------------------------------------------------------
# $(INCFILE_LIST) contains a list of all include files the current project
# depends on (in lower case characters).
#-----------------------------------------------------------------------------
INCFILE_LIST =                                                                                 \
              $(subst ???,\ ,                                                                  \
                  $(sort                                                                       \
                      $(call _toLower,                                                         \
                          $(sort                                                               \
                              $(subst /,\,                                                     \
                                  $(subst \ ,???,                                              \
                                      $(shell                                                  \
                                          $(SED)                                               \
                                          's/\\ /\?\?\?/g;                                     \
                                           s!\\$$!!g;                                          \
                                           s!\\!/!g;                                           \
                                           /Makefile.config/d;                                 \
                                           s/[^ ]*\.\(cpp\|cfg\|c\|$(OBJ_SUFFIX)\|$(LIB_SUFFIX)\|$(ASM_SUFFIX)\):\{0,1\}//gI;  \
                                           /^\#/d'                                             \
                                          $(PROJECT_NAME).dep                                  \
                                      )                                                        \
                                  )                                                            \
                              )                                                                \
                          )                                                                    \
                      )                                                                        \
                  )                                                                            \
              )

INCFILE_LIST_UNIX = $(subst ???,\ ,$(subst \,/,$(subst \ ,???,$(INCFILE_LIST))))

INCDIR_LIST  = $(subst ???,\ ,$(sort $(subst \ , ,$(subst \���,,$(dir $(subst \ ,???,$(INCFILE_LIST)))���))))

#-----------------------------------------------------------------------------
# $(compName) contains the name of the component which is used
#-----------------------------------------------------------------------------
ifeq ($(USE_AUTOSAR_MAKE),1)
compName = $(call asrName,$(1))
else
compName = $(1)
endif
#-----------------------------------------------------------------------------
# List of all the files which belong to the MakeSupport and can be modified
# $(MAKESUPPORT_LIST_SEP) - same separated by semicolon
#-----------------------------------------------------------------------------
MAKESUPPORT_LIST = Makefile                                                              \
                   $(PROJECT_NAME).dep                                                   \
                   $(MAKEFILE_CONFIG)                                                    \
                   Makefile.project.part.defines                                         \
                   Makefile.$(PLATFORM).$(COMPILER_MANUFACTURER).$(EMULATOR).make        \
                   pclint.lnt                                                            \
                   m.bat                                                                 \
                   b.bat

MAKESUPPORT_LIST_SEP = $(strip $(call separatedList,MAKESUPPORT_LIST,_SEMI_COLON))

MAKEFILE_CONFIG = $(shell if [ -f Makefile.config ] ; then $(ECHO) Makefile.config; fi)

#-----------------------------------------------------------------------------
# List of all possible 'wildcarded' error, list and map files
# $(XXX_SEP) - same separated by semicolon
# $(XXX_WOP) - without path
#-----------------------------------------------------------------------------
ERR_LIST               = $(addprefix $(ERR_PATH)\*.,$(ERR_SUFFIX_LIST))
ERR_LIST_SEP           = $(strip $(call separatedList,ERR_LIST,_SEMI_COLON))
LST_N_MAP_LIST         = $(addprefix $(LST_PATH)\*.,$(LST_SUFFIX_LIST)) $(PROJECT_NAME).map
LST_N_MAP_LIST_SEP     = $(strip $(call separatedList,LST_N_MAP_LIST,_SEMI_COLON))

ERR_LIST_WOP           = $(addprefix *.,$(ERR_SUFFIX_LIST))
ERR_LIST_SEP_WOP       = $(strip $(call separatedList,ERR_LIST_WOP,_SEMI_COLON))
LST_N_MAP_LIST_WOP     = $(addprefix *.,$(LST_SUFFIX_LIST)) $(PROJECT_NAME).map
LST_N_MAP_LIST_SEP_WOP = $(strip $(call separatedList,LST_N_MAP_LIST_WOP,_SEMI_COLON))


#-----------------------------------------------------------------------------
# create Microsoft Developer Studio Project File
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
visual: $(PROJECT_NAME).dsw $(PROJECT_NAME).dsp

$(PROJECT_NAME).dsw: force
	@$(ECHO) "Generating Microsoft Developer Studio Workspace: $(PROJECT_NAME).dsw ..."; \
 $(ECHO) "Microsoft Developer Studio Workspace File, Format Version 6.00"              > $@; \
 $(ECHO) "# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!"                      >> $@; \
 $(ECHO) ""                                                                           >> $@; \
 $(ECHO) "#####################################################################"      >> $@; \
 $(ECHO) ""                                                                           >> $@; \
 $(ECHO) "Project: \"$(PROJECT_NAME)\"=.\\$(PROJECT_NAME).dsp - Package Owner=<4>"    >> $@; \
 $(ECHO) ""                                                                           >> $@; \
 $(ECHO) "Package=<5>"                                                                >> $@; \
 $(ECHO) "{{{"                                                                        >> $@; \
 $(ECHO) "}}}"                                                                        >> $@; \
 $(ECHO) ""                                                                           >> $@; \
 $(ECHO) "Package=<4>"                                                                >> $@; \
 $(ECHO) "{{{"                                                                        >> $@; \
 $(ECHO) "}}}"                                                                        >> $@; \
 $(ECHO) ""                                                                           >> $@; \
 $(ECHO) "#####################################################################"      >> $@; \
 $(ECHO) ""                                                                           >> $@; \
 $(ECHO) "Global:"                                                                    >> $@; \
 $(ECHO) ""                                                                           >> $@; \
 $(ECHO) "Package=<5>"                                                                >> $@; \
 $(ECHO) "{{{"                                                                        >> $@; \
 $(ECHO) "}}}"                                                                        >> $@; \
 $(ECHO) ""                                                                           >> $@; \
 $(ECHO) "Package=<3>"                                                                >> $@; \
 $(ECHO) "{{{"                                                                        >> $@; \
 $(ECHO) "}}}"                                                                        >> $@; \
 $(ECHO) ""                                                                           >> $@; \
 $(ECHO) "#####################################################################"      >> $@; \
 $(ECHO) "...done";                                                                          \
 $(ECHO) "";

ifneq ($(PLATFORM),CANOE)

$(PROJECT_NAME).dsp: $(PROJECT_NAME).dsw
	@$(ECHO) "Generating Microsoft Developer Studio Project File: $(PROJECT_NAME).dsp ...";            \
 $(ECHO) "# Microsoft Developer Studio Project File - Name=\"$(PROJECT_NAME)\" - Package Owner=<4>"  > $@; \
 $(ECHO) "# Microsoft Developer Studio Generated Build File, Format Version 6.00"                   >> $@; \
 $(ECHO) "# ** DO NOT EDIT **"                                                                      >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "# TARGTYPE \"Win32 (x86) External Target\" 0x0106"                                        >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "CFG=$(PROJECT_NAME) - Win32 Debug"                                                        >> $@; \
 $(ECHO) "!MESSAGE This is not a valid makefile. To build this project using NMAKE,"                >> $@; \
 $(ECHO) "!MESSAGE use the Export Makefile command and run"                                         >> $@; \
 $(ECHO) "!MESSAGE "                                                                                >> $@; \
 $(ECHO) "!MESSAGE NMAKE /f \"$(PROJECT_NAME).mak\"."                                               >> $@; \
 $(ECHO) "!MESSAGE "                                                                                >> $@; \
 $(ECHO) "!MESSAGE You can specify a configuration when running NMAKE"                              >> $@; \
 $(ECHO) "!MESSAGE by defining the macro CFG on the command line. For example:"                     >> $@; \
 $(ECHO) "!MESSAGE "                                                                                >> $@; \
 $(ECHO) "!MESSAGE NMAKE /f \"$(PROJECT_NAME).mak\" CFG=\"$(PROJECT_NAME) - Win32 Debug\""          >> $@; \
 $(ECHO) "!MESSAGE "                                                                                >> $@; \
 $(ECHO) "!MESSAGE Possible choices for configuration are:"                                         >> $@; \
 $(ECHO) "!MESSAGE "                                                                                >> $@; \
 $(ECHO) "!MESSAGE \"$(PROJECT_NAME) - Win32 Release\" (based on \"Win32 (x86) External Target\")"  >> $@; \
 $(ECHO) "!MESSAGE \"$(PROJECT_NAME) - Win32 Debug\" (based on \"Win32 (x86) External Target\")"    >> $@; \
 $(ECHO) "!MESSAGE "                                                                                >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "# Begin Project"                                                                          >> $@; \
 $(ECHO) "# PROP AllowPerConfigDependencies 0"                                                      >> $@; \
 $(ECHO) "# PROP Scc_ProjName \"\""                                                                 >> $@; \
 $(ECHO) "# PROP Scc_LocalPath \"\""                                                                >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "!IF  \"\$$(CFG)\" == \"$(PROJECT_NAME) - Win32 Release\""                                 >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "# PROP BASE Use_MFC 0"                                                                    >> $@; \
 $(ECHO) "# PROP BASE Use_Debug_Libraries 0"                                                        >> $@; \
 $(ECHO) "# PROP BASE Output_Dir \"obj\\Release\""                                                  >> $@; \
 $(ECHO) "# PROP BASE Intermediate_Dir \"obj\\Release\""                                            >> $@; \
 $(ECHO) "# PROP BASE Cmd_Line \"NMAKE /f appl.mak\""                                               >> $@; \
 $(ECHO) "# PROP BASE Rebuild_Opt \"/a\""                                                           >> $@; \
 $(ECHO) "# PROP BASE Target_File \"$(PROJECT_NAME).$(BINARY_SUFFIX)\""                             >> $@; \
 $(ECHO) "# PROP BASE Bsc_Name \"$(PROJECT_NAME).bsc\""                                             >> $@; \
 $(ECHO) "# PROP BASE Target_Dir \"\""                                                              >> $@; \
 $(ECHO) "# PROP Use_MFC 0"                                                                         >> $@; \
 $(ECHO) "# PROP Use_Debug_Libraries 0"                                                             >> $@; \
 $(ECHO) "# PROP Output_Dir \"obj\\Release\""                                                       >> $@; \
 $(ECHO) "# PROP Intermediate_Dir \"obj\\Release\""                                                 >> $@; \
 $(ECHO) "# PROP Cmd_Line \"set ERR_TO_STDOUT=1 && m.bat\""                                         >> $@; \
 $(ECHO) "# PROP Rebuild_Opt \"rebuild\""                                                           >> $@; \
 $(ECHO) "# PROP Target_File \"$(PROJECT_NAME).$(BINARY_SUFFIX)\""                                  >> $@; \
 $(ECHO) "# PROP Bsc_Name \"$(PROJECT_NAME).bsc\""                                                  >> $@; \
 $(ECHO) "# PROP Target_Dir \"\""                                                                   >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "!ELSEIF  \"\$$(CFG)\" == \"$(PROJECT_NAME) - Win32 Debug\""                               >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "# PROP BASE Use_MFC 0"                                                                    >> $@; \
 $(ECHO) "# PROP BASE Use_Debug_Libraries 0"                                                        >> $@; \
 $(ECHO) "# PROP BASE Output_Dir \"obj\\Release\""                                                  >> $@; \
 $(ECHO) "# PROP BASE Intermediate_Dir \"obj\\Release\""                                            >> $@; \
 $(ECHO) "# PROP BASE Cmd_Line \"NMAKE /f appl.mak\""                                               >> $@; \
 $(ECHO) "# PROP BASE Rebuild_Opt \"/a\""                                                           >> $@; \
 $(ECHO) "# PROP BASE Target_File \"$(PROJECT_NAME).$(BINARY_SUFFIX)\""                             >> $@; \
 $(ECHO) "# PROP BASE Bsc_Name \"$(PROJECT_NAME).bsc\""                                             >> $@; \
 $(ECHO) "# PROP BASE Target_Dir \"\""                                                              >> $@; \
 $(ECHO) "# PROP Use_MFC 0"                                                                         >> $@; \
 $(ECHO) "# PROP Use_Debug_Libraries 0"                                                             >> $@; \
 $(ECHO) "# PROP Output_Dir \"obj\\Release\""                                                       >> $@; \
 $(ECHO) "# PROP Intermediate_Dir \"obj\\Release\""                                                 >> $@; \
 $(ECHO) "# PROP Cmd_Line \"set ERR_TO_STDOUT=1 && m.bat\""                                         >> $@; \
 $(ECHO) "# PROP Rebuild_Opt \"rebuild\""                                                           >> $@; \
 $(ECHO) "# PROP Target_File \"$(PROJECT_NAME).$(BINARY_SUFFIX)\""                                  >> $@; \
 $(ECHO) "# PROP Bsc_Name \"$(PROJECT_NAME).bsc\""                                                  >> $@; \
 $(ECHO) "# PROP Target_Dir \"\""                                                                   >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "!ENDIF"                                                                                   >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "# Begin Target"                                                                           >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "# Name \"$(PROJECT_NAME) - Win32 Release\""                                               >> $@; \
 $(ECHO) "# Name \"$(PROJECT_NAME) - Win32 Debug\""                                                 >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHOESC) $(foreach SDIR,$(subst \, ,$(PROJECT_DIR)),                                                    \
                '\n# Begin Group "$(SDIR)"\n'                                                              \
            )                                                                                       >> $@; \
 $(ECHO) "# Begin Group \"Source\""                                                                 >> $@; \
 $(ECHO) "# PROP Default_Filter \"c;cpp;def;bat;h\""                                                >> $@; \
 $(ECHOESC) $(foreach SRC,$(APP_SOURCE_LST),                                                               \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(subst \,\\,$(SRC))'                                                            \
                '\n# End Source File\n'                                                                    \
            )                                                                                       >> $@; \
 $(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(BRS_USED)),$(BRS_DATA)),                                   \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(subst \,\\,$(SRC))'                                                            \
                '\n# End Source File\n'                                                                    \
            )                                                                                       >> $@; \
 $(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(ZBRS_USED)),$(ZBRS_DATA)),                                 \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(subst \,\\,$(SRC))'                                                            \
                '\n# End Source File\n'                                                                    \
            )                                                                                       >> $@; \
 $(ECHO) "# End Group"                                                                              >> $@; \
 $(ECHO) ""                                                                                         >> $@; \
 $(ECHO) "# Begin Group \"GenData\""                                                                >> $@; \
 $(ECHO) "# PROP Default_Filter \"c;bat;h\""                                                        >> $@; \
 $(ECHOESC) $(foreach SRC,$(sort $(DATA_SOURCE_LST) $(MODULE_DATA_LST) $(MODULE_COMMON_LST)),              \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(subst \,\\,$(SRC))'                                                            \
                '\n# End Source File\n'                                                                    \
            )                                                                                       >> $@; \
 $(ECHO) "# End Group"                                                                              >> $@; \
 $(ECHOESC) $(foreach SDIR,$(subst \, ,$(PROJECT_DIR)),                                                    \
                '\n# End Group\n'                                                                          \
             )                                                                                      >> $@; \
 $(ECHOESC) $(foreach MODULE,$(filter-out BRS ZBRS OSEKOS,$(MODULE_USED_LST)),                             \
                '\n# Begin Group "$(call compName,$(MODULE))"'                                             \
                '\n# PROP Default_Filter "c;bat;h"'                                                        \
                $(foreach SRC,$(call compSources,$(MODULE)),                                               \
                    '\n# Begin Source File'                                                                \
                    '\nSOURCE=$(subst \,\\,$(ROOT)\$(SRC))'                                                \
                    '\n# End Source File\n'                                                                \
                )                                                                                          \
                '\n# End Group\n'                                                                          \
            )                                                                                       >> $@; \
 $(ECHOESC) $(if $(findstring $(OSEKOS_USED),1),                                                           \
                '\n# Begin Group "OSEKOS"'                                                                 \
                '\n# PROP Default_Filter "c;h;oil"'                                                        \
                $(if $(OSEKOS_$(PLATFORM)),,                                                               \
                    $(foreach SRC, $(OSEKOS_STAT_SRCS),                                                    \
                        '\n# Begin Source File'                                                            \
                        '\nSOURCE=$(subst \,\\,$(SRC))'                                                    \
                        '\n# End Source File\n'                                                            \
                    )                                                                                      \
                )                                                                                          \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(subst \,\\,$(SIMPLEOS_OIL))'                                                   \
                '\n# End Source File\n'                                                                    \
                '\n# End Group\n',                                                                         \
            )                                                                                       >> $@; \
 $(ECHO) "# Begin Group \"MakeSupport\""                                                            >> $@; \
 $(ECHO) "# PROP Default_Filter \"make;bat;dep;config;defines;lnt\""                                >> $@; \
 $(ECHOESC) $(foreach SRC,$(MAKESUPPORT_LIST),                                                             \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(SRC)'                                                                          \
                '\n# End Source File\n'                                                                    \
            )                                                                                       >> $@; \
 $(ECHO) "# End Group"                                                                              >> $@; \
 $(ECHO) "# Begin Group \"Error Files\""                                                            >> $@; \
 $(ECHO) "# PROP Default_Filter \"$(ERR_SUFFIX)\""                                                  >> $@; \
 $(ECHOESC) $(foreach SRC, $(foreach SFX, $(ERR_SUFFIX_LIST),                                              \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                       \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(ERR_PATH)\\$(SRC)'                                                             \
                '\n# End Source File\n'                                                                    \
            )                                                                                       >> $@; \
 $(ECHOESC) '\n# Begin Source File'                                                                        \
            '\nSOURCE=$(ERR_PATH)\\$(PROJECT_NAME).$(ERR_SUFFIX)'                                          \
            '\n# End Source File\n'                                                                 >> $@; \
 $(ECHO) "# End Group"                                                                              >> $@; \
 $(ECHO) "# Begin Group \"List and Map Files\""                                                     >> $@; \
 $(ECHO) "# PROP Default_Filter \"map$(addprefix ;,$(LST_SUFFIX))\""                                >> $@; \
 $(ECHOESC) $(foreach SRC, $(foreach SFX, $(LST_SUFFIX_LIST),                                              \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                       \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(LST_PATH)\\$(SRC)'                                                             \
                '\n# End Source File\n'                                                                    \
            )                                                                                       >> $@; \
 $(ECHOESC) '\n# Begin Source File'                                                                        \
            '\nSOURCE=$(PROJECT_NAME).map'                                                                 \
            '\n# End Source File\n'                                                                 >> $@; \
 $(ECHO) "# End Group"                                                                              >> $@; \
 $(ECHO) "# Begin Group \"PCLint Files\""                                                           >> $@; \
 $(ECHO) "# PROP Default_Filter \"txt\""                                                            >> $@; \
 $(ECHOESC) $(foreach SRC,                                                                                 \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%_lint.txt,$(BUILD_OBJECTS)),                      \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(LOG_PATH)\\$(SRC)'                                                             \
                '\n# End Source File\n'                                                                    \
            )                                                                                       >> $@; \
 $(ECHO) "# End Group"                                                                              >> $@; \
 $(ECHO) "# Begin Group \"External Dependencies\""                                                  >> $@; \
 $(ECHO) "# PROP Default_Filter \"h\""                                                              >> $@; \
 $(ECHOESC) $(subst ???, ,$(foreach INC,$(subst \,\\,$(subst \ ,???,$(INCFILE_LIST))),                     \
                '\n# Begin Source File'                                                                    \
                '\nSOURCE=$(INC)'                                                                          \
                '\n# End Source File\n'                                                                    \
            ))                                                                                      >> $@; \
 $(ECHO) "# End Group"                                                                              >> $@; \
 $(ECHO) "# End Target"                                                                             >> $@; \
 $(ECHO) "# End Project"                                                                            >> $@; \
 $(ECHO) "...done";                                                                                        \
 $(ECHO) "";
endif

#-----------------------------------------------------------------------------
# create Microsoft Visual Studio .Net 2003 Project File
#-----------------------------------------------------------------------------
visual7: $(PROJECT_NAME)7.sln $(PROJECT_NAME)7.vcproj

$(PROJECT_NAME)7.sln: force
	@$(ECHO) "Generating Microsoft Visual Studio Solution File: $@ ...";                                  \
 $(ECHO) 'Microsoft Visual Studio Solution File, Format Version 8.00'                                   > $@; \
 $(ECHO) 'Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$(PROJECT_NAME)", "$(PROJECT_NAME)7.vcproj", "{7664B810-AB01-4902-8D60-32FE16A82E5E}"'>> $@; \
 $(ECHO) '	ProjectSection(ProjectDependencies) = postProject'                                      >> $@; \
 $(ECHO) '	EndProjectSection'                                                                      >> $@; \
 $(ECHO) 'EndProject'                                                                               >> $@; \
 $(ECHO) 'Global'                                                                                   >> $@; \
 $(ECHO) '	GlobalSection(SolutionConfiguration) = preSolution'                                     >> $@; \
 $(ECHO) '		Debug = Debug'                                                                        >> $@; \
 $(ECHO) '		Release = Release'                                                                    >> $@; \
 $(ECHO) '	EndGlobalSection'                                                                       >> $@; \
 $(ECHO) '	GlobalSection(ProjectConfiguration) = postSolution'                                     >> $@; \
 $(ECHO) '		{7664B810-AB01-4902-8D60-32FE16A82E5E}.Debug.ActiveCfg = Debug|Win32'                 >> $@; \
 $(ECHO) '		{7664B810-AB01-4902-8D60-32FE16A82E5E}.Debug.Build.0 = Debug|Win32'                   >> $@; \
 $(ECHO) '		{7664B810-AB01-4902-8D60-32FE16A82E5E}.Release.ActiveCfg = Release|Win32'             >> $@; \
 $(ECHO) '		{7664B810-AB01-4902-8D60-32FE16A82E5E}.Release.Build.0 = Release|Win32'               >> $@; \
 $(ECHO) '	EndGlobalSection'                                                                       >> $@; \
 $(ECHO) '	GlobalSection(ExtensibilityGlobals) = postSolution'                                     >> $@; \
 $(ECHO) '	EndGlobalSection'                                                                       >> $@; \
 $(ECHO) '	GlobalSection(ExtensibilityAddIns) = postSolution'                                      >> $@; \
 $(ECHO) '	EndGlobalSection'                                                                       >> $@; \
 $(ECHO) 'EndGlobal'                                                                                >> $@; \
 $(ECHO) "...done";                                                                                           \
 $(ECHO) "";

#-----------------------------------------------------------------------------
# create Microsoft Visual Studio .Net 2008 Solution
#-----------------------------------------------------------------------------
visual9: $(PROJECT_NAME)9.sln $(PROJECT_NAME)9.vcproj

$(PROJECT_NAME)9.sln: force
	@$(ECHO) "Generating Microsoft Visual Studio Solution File: $@ ...";                                  \
  $(ECHO) 'Microsoft Visual Studio Solution File, Format Version 10.00'                              > $@; \
  $(ECHO) '# Visual Studio 2008'                                                               >> $@; \
  $(ECHO) 'Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$(PROJECT_NAME)", "$(PROJECT_NAME)9.vcproj", "{B6E148C0-C167-411E-AE68-9B5EB7F1F93F}"'>> $@; \
  $(ECHO) 'EndProject'                                                                              >> $@; \
  $(ECHO) 'Global'                                                                                  >> $@; \
  $(ECHO) '  GlobalSection(SolutionConfigurationPlatforms) = preSolution'                           >> $@; \
  $(ECHO) '    Debug|Win32 = Debug|Win32'                                                           >> $@; \
  $(ECHO) '    Release|Win32 = Release|Win32'                                                       >> $@; \
  $(ECHO) '  EndGlobalSection'                                                                      >> $@; \
  $(ECHO) '  GlobalSection(ProjectConfigurationPlatforms) = postSolution'                           >> $@; \
  $(ECHO) '    {B6E148C0-C167-411E-AE68-9B5EB7F1F93F}.Debug|Win32.ActiveCfg = Debug|Win32'          >> $@; \
  $(ECHO) '    {B6E148C0-C167-411E-AE68-9B5EB7F1F93F}.Debug|Win32.Build.0 = Debug|Win32'            >> $@; \
  $(ECHO) '    {B6E148C0-C167-411E-AE68-9B5EB7F1F93F}.Release|Win32.ActiveCfg = Release|Win32'      >> $@; \
  $(ECHO) '    {B6E148C0-C167-411E-AE68-9B5EB7F1F93F}.Release|Win32.Build.0 = Release|Win32'        >> $@; \
  $(ECHO) '  EndGlobalSection'                                                                      >> $@; \
  $(ECHO) '  GlobalSection(SolutionProperties) = preSolution'                                       >> $@; \
  $(ECHO) '  HideSolutionNode = FALSE'                                                              >> $@; \
  $(ECHO) '  EndGlobalSection'                                                                      >> $@; \
  $(ECHO) 'EndGlobal'                                                                               >> $@; \
  $(ECHO) "...done";                                                                                       \
  $(ECHO) "";

#-----------------------------------------------------------------------------
# create Microsoft Visual Studio .Net 2005 Solution
#-----------------------------------------------------------------------------
visual8: $(PROJECT_NAME)8.sln $(PROJECT_NAME)8.vcproj

$(PROJECT_NAME)8.sln: force
	@$(ECHO) "Generating Microsoft Visual Studio Solution File: $@ ...";                                  \
  $(ECHO) 'Microsoft Visual Studio Solution File, Format Version 9.00'                              > $@; \
  $(ECHO) '# Visual C++ Express 2005'                                                               >> $@; \
  $(ECHO) 'Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$(PROJECT_NAME)", "$(PROJECT_NAME)8.vcproj", "{7664B810-AB01-4902-8D60-32FE16A82E5E}"'>> $@; \
  $(ECHO) 'EndProject'                                                                              >> $@; \
  $(ECHO) 'Global'                                                                                  >> $@; \
  $(ECHO) '  GlobalSection(SolutionConfigurationPlatforms) = preSolution'                           >> $@; \
  $(ECHO) '    Debug|Win32 = Debug|Win32'                                                           >> $@; \
  $(ECHO) '    Release|Win32 = Release|Win32'                                                       >> $@; \
  $(ECHO) '  EndGlobalSection'                                                                      >> $@; \
  $(ECHO) '  GlobalSection(ProjectConfigurationPlatforms) = postSolution'                           >> $@; \
  $(ECHO) '    {7664B810-AB01-4902-8D60-32FE16A82E5E}.Debug|Win32.ActiveCfg = Debug|Win32'          >> $@; \
  $(ECHO) '    {7664B810-AB01-4902-8D60-32FE16A82E5E}.Debug|Win32.Build.0 = Debug|Win32'            >> $@; \
  $(ECHO) '    {7664B810-AB01-4902-8D60-32FE16A82E5E}.Release|Win32.ActiveCfg = Release|Win32'      >> $@; \
  $(ECHO) '    {7664B810-AB01-4902-8D60-32FE16A82E5E}.Release|Win32.Build.0 = Release|Win32'        >> $@; \
  $(ECHO) '  EndGlobalSection'                                                                      >> $@; \
  $(ECHO) '  GlobalSection(SolutionProperties) = preSolution'                                       >> $@; \
  $(ECHO) '  HideSolutionNode = FALSE'                                                              >> $@; \
  $(ECHO) '  EndGlobalSection'                                                                      >> $@; \
  $(ECHO) 'EndGlobal'                                                                               >> $@; \
  $(ECHO) "...done";                                                                                       \
  $(ECHO) "";

#-----------------------------------------------------------------------------
# create Microsoft Visual Studio 2003 Visual C++ Project
#-----------------------------------------------------------------------------
ifneq ($(PLATFORM),CANOE)
$(PROJECT_NAME)7.vcproj: $(PROJECT_NAME)7.sln
	@$(ECHO) "Generating Microsoft Visual Studio Project File: $@ ...";                                   \
 $(ECHO) '<?xml version="1.0" encoding="Windows-1252"?>'                                                > $@; \
 $(ECHO) '<VisualStudioProject'                                                                     >> $@; \
 $(ECHO) '	ProjectType="Visual C++"'                                                               >> $@; \
 $(ECHO) '	Version="7.10"'                                                                         >> $@; \
 $(ECHO) '	Name="$(PROJECT_NAME)"'                                                                 >> $@; \
 $(ECHO) '	SccProjectName=""'                                                                      >> $@; \
 $(ECHO) '	SccLocalPath="">'                                                                       >> $@; \
 $(ECHO) '	<Platforms>'                                                                            >> $@; \
 $(ECHO) '		<Platform'                                                                            >> $@; \
 $(ECHO) '			Name="Win32"/>'                                                                     >> $@; \
 $(ECHO) '	</Platforms>'                                                                           >> $@; \
 $(ECHO) '	<Configurations>'                                                                       >> $@; \
 $(ECHO) '		<Configuration'                                                                       >> $@; \
 $(ECHO) '			Name="Debug|Win32"'                                                                 >> $@; \
 $(ECHO) '			OutputDirectory=".\$(OBJ_PATH)"'                                                    >> $@; \
 $(ECHO) '			IntermediateDirectory=".\$(OBJ_PATH)"'                                              >> $@; \
 $(ECHO) '			ConfigurationType="0">'                                                             >> $@; \
 $(ECHO) '			<Tool'                                                                              >> $@; \
 $(ECHO) '				Name="VCNMakeTool"'                                                               >> $@; \
 $(ECHO) '				BuildCommandLine="set ERR_TO_STDOUT=1 &amp;&amp; m.bat"'                          >> $@; \
 $(ECHO) '				ReBuildCommandLine="set ERR_TO_STDOUT=1 &amp;&amp; b.bat"'                        >> $@; \
 $(ECHO) '				CleanCommandLine="set ERR_TO_STDOUT=1 &amp;&amp; m.bat clean"'                    >> $@; \
 $(ECHO) '				Output="$(PROJECT_NAME).$(BINARY_SUFFIX)"/>'                                      >> $@; \
 $(ECHO) '		</Configuration>'                                                                     >> $@; \
 $(ECHO) '	</Configurations>'                                                                      >> $@; \
 $(ECHO) '	<References>'                                                                           >> $@; \
 $(ECHO) '	</References>'                                                                          >> $@; \
 $(ECHO) '	<Files>'                                                                                >> $@; \
 $(ECHO) '		<Filter'                                                                              >> $@; \
 $(ECHO) '			Name="Source"'                                                                      >> $@; \
 $(ECHO) '			Filter="c;cpp;def;bat;h">'                                                          >> $@; \
 $(ECHOESC) $(foreach SRC,$(APP_SOURCE_LST),                                                               \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(subst \,\\,$(SRC))">'                                            \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
 $(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(BRS_USED)),$(BRS_DATA)),                                   \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(subst \,\\,$(SRC))">'                                            \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
 $(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(ZBRS_USED)),$(ZBRS_DATA)),                                 \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(subst \,\\,$(SRC))">'                                            \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
 $(ECHO) '    </Filter>'                                                                            >> $@; \
 $(ECHO) '    <Filter'                                                                              >> $@; \
 $(ECHO) '      Name="GenData"'                                                                     >> $@; \
 $(ECHO) '      Filter="c;cpp;def;bat;h">'                                                          >> $@; \
 $(ECHOESC) $(foreach SRC,$(sort $(DATA_SOURCE_LST) $(MODULE_DATA_LST) $(MODULE_COMMON_LST)),              \
                '\n      <File'                                                                            \
                '\n        RelativePath="$(subst \,\\,$(SRC))">'                                           \
                '\n      </File>'                                                                          \
            )                                                                                       >> $@; \
 $(ECHO) '		</Filter>'                                                                            >> $@; \
 $(ECHOESC) $(foreach MODULE,$(filter-out BRS ZBRS OSEKOS,$(MODULE_USED_LST)),                             \
                '\n		<Filter'                                                                             \
                '\n			Name="$(call compName,$(MODULE))"'                                                 \
                '\n			Filter="c;cpp;def;bat;h">'                                                         \
                $(foreach SRC,$(call compSources,$(MODULE)),                                               \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(subst \,\\,$(ROOT)\$(SRC))">'                                    \
                '\n			</File>'                                                                           \
                )                                                                                          \
                '\n		</Filter>'                                                                           \
             )                                                                                      >> $@; \
 $(ECHOESC) $(if $(findstring $(OSEKOS_USED),1),                                                           \
                '		<Filter'                                                                               \
                '\n			Name="OSEKOS"'                                                                     \
                '\n			Filter="c;cpp;def;bat;h;oil">'                                                     \
                $(if $(OSEKOS_$(PLATFORM)),                                                                \
                    $(foreach SRC,$(OSEKOS_$(PLATFORM)),                                                   \
                        '\n			<File'                                                                     \
                        '\n				RelativePath="$(subst \,\\,$(SRC))">'                                    \
                        '\n			</File>'                                                                   \
                    )                                                                                      \
                    ,                                                                                      \
                    $(foreach SRC, $(OSEKOS_STAT_SRCS),                                                    \
                        '\n			<File'                                                                     \
                        '\n				RelativePath="$(subst \,\\,$(SRC))">'                                    \
                        '\n			</File>'                                                                   \
                    )                                                                                      \
                )                                                                                          \
                '\n		</Filter>'                                                                           \
            )                                                                                       >> $@; \
 $(ECHO) '		<Filter'                                                                              >> $@; \
 $(ECHO) '			Name="MakeSupport"'                                                                 >> $@; \
 $(ECHO) '			Filter="make;bat;dep;config;defines;lnt">'                                          >> $@; \
 $(ECHOESC) $(foreach SRC,$(MAKESUPPORT_LIST),                                                             \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(SRC)">'                                                          \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
 $(ECHO) '		</Filter>'                                                                            >> $@; \
 $(ECHO) '		<Filter'                                                                              >> $@; \
 $(ECHO) '			Name="Error Files"'                                                                 >> $@; \
 $(ECHO) '			Filter="$(ERR_SUFFIX)">'                                                            >> $@; \
 $(ECHOESC) $(foreach SRC, $(foreach SFX, $(ERR_SUFFIX_LIST),                                              \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                       \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(ERR_PATH)\\$(SRC)">'                                             \
                '\n			</File>'                                                                           \
            )                                                                                              \
            '\n			<File'                                                                                 \
            '\n				RelativePath="$(ERR_PATH)\\$(PROJECT_NAME).$(ERR_SUFFIX)">'                          \
            '\n			</File>'                                                                        >> $@; \
 $(ECHO) '		</Filter>'                                                                            >> $@; \
 $(ECHO) '		<Filter'                                                                              >> $@; \
 $(ECHO) '			Name="List and Map Files"'                                                          >> $@; \
 $(ECHO) '			Filter="map$(addprefix ;,$(LST_SUFFIX))">'                                          >> $@; \
 $(ECHOESC) $(foreach SRC, $(foreach SFX, $(LST_SUFFIX_LIST),                                              \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                       \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(LST_PATH)\\$(SRC)">'                                             \
                '\n			</File>'                                                                           \
            )                                                                                              \
            '\n			<File'                                                                                 \
            '\n				RelativePath="$(PROJECT_NAME).map">'                                                 \
            '\n			</File>'                                                                        >> $@; \
 $(ECHO) '		</Filter>'                                                                            >> $@; \
 $(ECHO) '		<Filter'                                                                              >> $@; \
 $(ECHO) '			Name="PCLint Files"'                                                                >> $@; \
 $(ECHO) '			Filter="txt">'                                                                      >> $@; \
 $(ECHOESC) $(foreach SRC,                                                                                 \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%_lint.txt,$(BUILD_OBJECTS)),                      \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(LOG_PATH)\\$(SRC)">'                                             \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
 $(ECHO) '		</Filter>'                                                                            >> $@; \
 $(ECHO) '		<Filter'                                                                              >> $@; \
 $(ECHO) '			Name="External Dependencies"'                                                       >> $@; \
 $(ECHO) '			Filter="h">'                                                                        >> $@; \
 $(ECHOESC) $(subst ???, ,$(foreach INC,$(subst \,\\,$(subst \ ,???,$(INCFILE_LIST))),                     \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(INC)">'                                                          \
                '\n			</File>'                                                                           \
            ))                                                                                      >> $@; \
 $(ECHO) '		</Filter>'                                                                            >> $@; \
 $(ECHO) '	</Files>'                                                                               >> $@; \
 $(ECHO) '	<Globals>'                                                                              >> $@; \
 $(ECHO) '	</Globals>'                                                                             >> $@; \
 $(ECHO) '</VisualStudioProject>'                                                                   >> $@; \
 $(ECHO) "...done";                                                                                        \
 $(ECHO) "";
endif

#-----------------------------------------------------------------------------
# create Microsoft Visual Studio 2008 Visual C++ Project
#-----------------------------------------------------------------------------
ifneq ($(PLATFORM),CANOE)
$(PROJECT_NAME)9.vcproj: $(PROJECT_NAME)9.sln
	@$(ECHO) "Generating Microsoft Visual Studio Project File: $@ ...";                                   \
 $(ECHO) '<?xml version="1.0" encoding="Windows-1252"?>'                                            > $@; \
 $(ECHO) '<VisualStudioProject'                                                                     >> $@; \
 $(ECHO) '	ProjectType="Visual C++"'                                                               >> $@; \
 $(ECHO) '  Version="9.00"'                                                                         >> $@; \
 $(ECHO) '	Name="$(PROJECT_NAME)"'                                                                 >> $@; \
 $(ECHO) '  >'                                                                                      >> $@; \
	$(VCPROJ_8_9)                                                                                            \
 $(ECHO) "...done";                                                                                        \
 $(ECHO) "";
endif


#-----------------------------------------------------------------------------
# create Microsoft Visual Studio 2005 Visual C++ Project
#-----------------------------------------------------------------------------
ifneq ($(PLATFORM),CANOE)
$(PROJECT_NAME)8.vcproj: $(PROJECT_NAME)8.sln
	@$(ECHO) "Generating Microsoft Visual Studio Project File: $@ ...";                                   \
 $(ECHO) '<?xml version="1.0" encoding="Windows-1252"?>'                                            > $@; \
 $(ECHO) '<VisualStudioProject'                                                                     >> $@; \
 $(ECHO) '	ProjectType="Visual C++"'                                                               >> $@; \
 $(ECHO) '  Version="8.00"'                                                                         >> $@; \
 $(ECHO) '	Name="$(PROJECT_NAME)"'                                                                 >> $@; \
 $(ECHO) '  >'                                                                                      >> $@; \
	$(VCPROJ_8_9)                                                                                            \
 $(ECHO) "...done";                                                                                        \
 $(ECHO) "";
endif
ifneq ($(PLATFORM),CANOE)
define VCPROJ_8_9
	$(ECHO) '	<Platforms>'                                                                            >> $@; \
	$(ECHO) '		<Platform'                                                                            >> $@; \
	$(ECHO) '			Name="Win32"/>'                                                                     >> $@; \
	$(ECHO) '	</Platforms>'                                                                           >> $@; \
	$(ECHO) '	<Configurations>'                                                                       >> $@; \
	$(ECHO) '		<Configuration'                                                                       >> $@; \
	$(ECHO) '			Name="Debug|Win32"'                                                                 >> $@; \
	$(ECHO) '			OutputDirectory=".\$(OBJ_PATH)"'                                                    >> $@; \
	$(ECHO) '			IntermediateDirectory=".\$(OBJ_PATH)"'                                              >> $@; \
	$(ECHO) '			ConfigurationType="0">'                                                             >> $@; \
	$(ECHO) '			<Tool'                                                                              >> $@; \
	$(ECHO) '				Name="VCNMakeTool"'                                                               >> $@; \
	$(ECHO) '				BuildCommandLine="set ERR_TO_STDOUT=1 &amp;&amp; m.bat"'                          >> $@; \
	$(ECHO) '				ReBuildCommandLine="set ERR_TO_STDOUT=1 &amp;&amp; b.bat"'                        >> $@; \
	$(ECHO) '				CleanCommandLine="set ERR_TO_STDOUT=1 &amp;&amp; m.bat clean"'                    >> $@; \
	$(ECHO) '				Output="$(PROJECT_NAME).$(BINARY_SUFFIX)"/>'                                      >> $@; \
	$(ECHO) '		</Configuration>'                                                                     >> $@; \
	$(ECHO) '	</Configurations>'                                                                      >> $@; \
	$(ECHO) '	<References>'                                                                           >> $@; \
	$(ECHO) '	</References>'                                                                          >> $@; \
	$(ECHO) '	<Files>'                                                                                >> $@; \
	$(ECHO) '		<Filter'                                                                              >> $@; \
	$(ECHO) '			Name="Source"'                                                                      >> $@; \
	$(ECHO) '			Filter="c;cpp;def;bat;h">'                                                          >> $@; \
	$(ECHOESC) $(foreach SRC,$(APP_SOURCE_LST),                                                              \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(subst \,\\,$(SRC))">'                                            \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
	$(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(BRS_USED)),$(BRS_DATA)),                                  \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(subst \,\\,$(SRC))">'                                            \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
	$(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(ZBRS_USED)),$(ZBRS_DATA)),                                \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(subst \,\\,$(SRC))">'                                            \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
	$(ECHO) '    </Filter>'                                                                           >> $@; \
	$(ECHO) '    <Filter'                                                                             >> $@; \
	$(ECHO) '      Name="GenData"'                                                                    >> $@; \
	$(ECHO) '      Filter="c;cpp;def;bat;h">'                                                         >> $@; \
	$(ECHOESC) $(foreach SRC,$(sort $(DATA_SOURCE_LST) $(MODULE_DATA_LST) $(MODULE_COMMON_LST)),             \
                '\n      <File'                                                                            \
                '\n        RelativePath="$(subst \,\\,$(SRC))">'                                           \
                '\n      </File>'                                                                          \
            )                                                                                       >> $@; \
	$(ECHO) '		</Filter>'                                                                            >> $@; \
	$(ECHOESC) $(foreach MODULE,$(filter-out BRS ZBRS OSEKOS,$(MODULE_USED_LST)),                            \
                '\n		<Filter'                                                                             \
                '\n			Name="$(call compName,$(MODULE))"'                                                 \
                '\n			Filter="c;cpp;def;bat;h">'                                                         \
                $(foreach SRC,$(filter-out $(call _toLower,$(SOURCES_IN_LIBS)),$(call compSources,$(MODULE))),\
                '\n			<File'                                                                             \
                '\n				RelativePath="$(subst \,\\,$(ROOT)\$(SRC))">'                                     \
                '\n			</File>'                                                                           \
                )                                                                                          \
                '\n		</Filter>'                                                                           \
             )                                                                                      >> $@; \
	$(ECHOESC) $(if $(findstring $(OSEKOS_USED),1),                                                          \
                '		<Filter'                                                                               \
                '\n			Name="OSEKOS"'                                                                     \
                '\n			Filter="c;cpp;def;bat;h;oil">'                                                     \
                $(if $(OSEKOS_$(PLATFORM)),                                                                \
                    $(foreach SRC,$(OSEKOS_$(PLATFORM)),                                                   \
                        '\n			<File'                                                                     \
                        '\n				RelativePath="$(subst \,\\,$(SRC))">'                                    \
                        '\n			</File>'                                                                   \
                    )                                                                                      \
                    ,                                                                                      \
                    $(foreach SRC, $(OSEKOS_STAT_SRCS),                                                    \
                        '\n			<File'                                                                     \
                        '\n				RelativePath="$(subst \,\\,$(SRC))">'                                    \
                        '\n			</File>'                                                                   \
                    )                                                                                      \
                )                                                                                          \
                '\n		</Filter>'                                                                           \
            )                                                                                       >> $@; \
	$(ECHO) '		<Filter'                                                                              >> $@; \
	$(ECHO) '			Name="MakeSupport"'                                                                 >> $@; \
	$(ECHO) '			Filter="make;bat;dep;config;defines;lnt">'                                          >> $@; \
	$(ECHOESC) $(foreach SRC,$(MAKESUPPORT_LIST),                                                            \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(SRC)">'                                                          \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
	$(ECHO) '		</Filter>'                                                                            >> $@; \
	$(ECHO) '		<Filter'                                                                              >> $@; \
	$(ECHO) '			Name="Error Files"'                                                                 >> $@; \
	$(ECHO) '			Filter="$(ERR_SUFFIX)">'                                                            >> $@; \
	$(ECHOESC) $(foreach SRC, $(foreach SFX, $(ERR_SUFFIX_LIST),                                             \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                       \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(ERR_PATH)\\$(SRC)">'                                             \
                '\n			</File>'                                                                           \
            )                                                                                              \
            '\n			<File'                                                                                 \
            '\n				RelativePath="$(ERR_PATH)\\$(PROJECT_NAME).$(ERR_SUFFIX)">'                          \
            '\n			</File>'                                                                        >> $@; \
	$(ECHO) '		</Filter>'                                                                            >> $@; \
	$(ECHO) '		<Filter'                                                                              >> $@; \
	$(ECHO) '			Name="List and Map Files"'                                                          >> $@; \
	$(ECHO) '			Filter="map$(addprefix ;,$(LST_SUFFIX))">'                                          >> $@; \
	$(ECHOESC) $(foreach SRC, $(foreach SFX, $(LST_SUFFIX_LIST),                                             \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                       \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(LST_PATH)\\$(SRC)">'                                             \
                '\n			</File>'                                                                           \
            )                                                                                              \
            '\n			<File'                                                                                 \
            '\n				RelativePath="$(PROJECT_NAME).map">'                                                 \
            '\n			</File>'                                                                        >> $@; \
	$(ECHO) '		</Filter>'                                                                            >> $@; \
	$(ECHO) '		<Filter'                                                                              >> $@; \
	$(ECHO) '			Name="PCLint Files"'                                                                >> $@; \
	$(ECHO) '			Filter="txt">'                                                                      >> $@; \
	$(ECHOESC) $(foreach SRC,                                                                                \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%_lint.txt,$(BUILD_OBJECTS)),                      \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(LOG_PATH)\\$(SRC)">'                                             \
                '\n			</File>'                                                                           \
            )                                                                                       >> $@; \
	$(ECHO) '		</Filter>'                                                                            >> $@; \
	$(ECHO) '		<Filter'                                                                              >> $@; \
	$(ECHO) '			Name="External Dependencies"'                                                       >> $@; \
	$(ECHO) '			Filter="h">'                                                                        >> $@; \
	$(ECHOESC) $(subst ???, ,$(foreach INC,$(subst \,\\,$(subst \ ,???,$(INCFILE_LIST))),                    \
                '\n			<File'                                                                             \
                '\n				RelativePath="$(INC)">'                                                          \
                '\n			</File>'                                                                           \
            ))                                                                                      >> $@; \
	$(ECHO) '		</Filter>'                                                                            >> $@; \
	$(ECHO) '	</Files>'                                                                               >> $@; \
	$(ECHO) '	<Globals>'                                                                              >> $@; \
	$(ECHO) '	</Globals>'                                                                             >> $@; \
	$(ECHO) '</VisualStudioProject>'                                                                  >> $@;
endef
endif
#-----------------------------------------------------------------------------
# create Microsoft Visual Studio 2010 Solution
#-----------------------------------------------------------------------------

visual10: $(PROJECT_NAME)10.sln $(PROJECT_NAME)10.vcxproj.users $(PROJECT_NAME)10.vcxproj.filters $(PROJECT_NAME)10.vcxproj 

#---------------------------------------------------------------------------------------------------------------- 
# .sln
#---------------------------------------------------------------------------------------------------------------- 
#Visual Studio 2010

$(PROJECT_NAME)10.sln: force
	@$(ECHO) "Generating Microsoft Visual Studio Solution File: $@ ...";                                  \
  $(ECHO) 'Microsoft Visual Studio Solution File, Format Version 11.00'                             > $@; \
  $(ECHO) '# Visual C++ Express 2010'                                                              >> $@; \
  $(ECHO) 'Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "$(PROJECT_NAME)", "$(PROJECT_NAME)10.vcxproj", "{665AAE83-81C0-DC97-5FEF-44F6E06327CC}"' >> $@; \
  $(ECHO) 'EndProject'                                                                             >> $@; \
  $(ECHO) 'Global'                                                                                 >> $@; \
  $(ECHO) '	GlobalSection(SolutionConfigurationPlatforms) = preSolution'                           >> $@; \
  $(ECHO) '		Debug|Win32 = Debug|Win32'                                                           >> $@; \
  $(ECHO) '		Release|Win32 = Release|Win32'                                                       >> $@; \
  $(ECHO) '	EndGlobalSection'                                                                      >> $@; \
  $(ECHO) '	GlobalSection(ProjectConfigurationPlatforms) = postSolution'                           >> $@; \
  $(ECHO) '		{665AAE83-81C0-DC97-5FEF-44F6E06327CC}.Debug|Win32.ActiveCfg = Debug|Win32'          >> $@; \
  $(ECHO) '		{665AAE83-81C0-DC97-5FEF-44F6E06327CC}.Debug|Win32.Build.0 = Debug|Win32'            >> $@; \
  $(ECHO) '		{665AAE83-81C0-DC97-5FEF-44F6E06327CC}.Release|Win32.ActiveCfg = Release|Win32'          >> $@; \
  $(ECHO) '		{665AAE83-81C0-DC97-5FEF-44F6E06327CC}.Release|Win32.Build.0 = Release|Win32'            >> $@; \
  $(ECHO) '	EndGlobalSection'                                                                      >> $@; \
  $(ECHO) '	GlobalSection(SolutionProperties) = preSolution'                                       >> $@; \
  $(ECHO) '		HideSolutionNode = FALSE'                                                            >> $@; \
  $(ECHO) '	EndGlobalSection'                                                                      >> $@; \
  $(ECHO) 'EndGlobal'                                                                              >> $@; \
  $(ECHO) "...done";                                                                                      \
  $(ECHO) "";

#---------------------------------------------------------------------------------------------------------------- 
# vcxproj.users
#---------------------------------------------------------------------------------------------------------------- 

$(PROJECT_NAME)10.vcxproj.users: force
	@$(ECHO) "Generating Microsoft Visual Studio User Project File: $@ ...";                                  \
  $(ECHO) '<?xml version="1.0" encoding="utf-8"?>'                                                      > $@; \
  $(ECHO) '<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">'   >> $@; \
  $(ECHO) '</Project>'                                                                                 >> $@; \
  $(ECHO) "...done";                                                                                          \
  $(ECHO) "";
  
#---------------------------------------------------------------------------------------------------------------- 
# vcxproj.filters
#---------------------------------------------------------------------------------------------------------------- 

ifneq ($(PLATFORM),CANOE)
$(PROJECT_NAME)10.vcxproj.filters: force
	@$(ECHO) "Generating Microsoft Visual Studio Filter Project File: $@ ...";                                  \
  $(ECHO) '<?xml version="1.0" encoding="utf-8"?>'                                                        > $@; \
  $(ECHO) '<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">'     >> $@; \
  $(ECHO) '  <ItemGroup>'                                                                                >> $@; \
  $(ECHO) '    <Filter Include="Source">'                                                                >> $@; \
  $(ECHO) '      <Extensions>c;cpp;def;bat;h</Extensions>'                                               >> $@; \
  $(ECHO) '    </Filter>'                                                                                >> $@; \
  $(ECHO) '    <Filter Include="GenData">'                                                               >> $@; \
  $(ECHO) '      <Extensions>c;cpp;def;bat;h</Extensions>'                                               >> $@; \
  $(ECHO) '    </Filter>'                                                                                >> $@; \
  $(ECHOESC) $(foreach MODULE,$(filter-out BRS ZBRS OSEKOS,$(MODULE_USED_LST)),                                 \
               '\n    <Filter Include="$(call compName,$(MODULE))">'                                                             \
               '\n      <Extensions>c;cpp;def;bat;h</Extensions>'                                               \
               '\n    </Filter>'                                                                                \
               )                                                                                         >> $@; \
  $(ECHOESC) $(if $(findstring $(OSEKOS_USED),1),                                                               \
               '\n    <Filter Include="OSEKOS">'                                                                \
               '\n      <Extensions>c;cpp;def;bat;h;oil</Extensions>'                                           \
               '\n    </Filter>'                                                                                \
               )                                                                                         >> $@; \
  $(ECHO) '    <Filter Include="MakeSupport">'                                                           >> $@; \
  $(ECHO) '      <Extensions>make;bat;dep;config;defines;lnt</Extensions>'                               >> $@; \
  $(ECHO) '    </Filter>'                                                                                >> $@; \
  $(ECHO) '    <Filter Include="Error Files">'                                                           >> $@; \
  $(ECHO) '      <Extensions>err</Extensions>'                                                           >> $@; \
  $(ECHO) '    </Filter>'                                                                                >> $@; \
  $(ECHO) '    <Filter Include="List and Map Files">'                                                    >> $@; \
  $(ECHO) '      <Extensions>map;lst</Extensions>'                                                       >> $@; \
  $(ECHO) '    </Filter>'                                                                                >> $@; \
  $(ECHO) '    <Filter Include="PCLint Files">'                                                          >> $@; \
  $(ECHO) '      <Extensions>txt</Extensions>'                                                           >> $@; \
  $(ECHO) '    </Filter>'                                                                                >> $@; \
  $(ECHO) '    <Filter Include="External Dependencies">'                                                 >> $@; \
  $(ECHO) '      <Extensions>h</Extensions>'                                                             >> $@; \
  $(ECHO) '    </Filter>'                                                                                >> $@; \
  $(ECHO) '  </ItemGroup>'                                                                               >> $@; \
  $(ECHO) '  <ItemGroup>'                                                                                >> $@; \
   $(ECHOESC) $(foreach SRC,$(APP_SOURCE_LST),                                                                  \
          '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))">'                                       \
          '\n      <Filter>Source</Filter>'                                                                     \
          '\n    </ClCompile>'                                                                                  \
    )                                                                                                    >> $@; \
   $(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(BRS_USED)),$(BRS_DATA)),                                      \
          '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))">'                                       \
          '\n      <Filter>Source</Filter>'                                                                     \
          '\n    </ClCompile>'                                                                                  \
   )                                                                                                     >> $@; \
   $(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(ZBRS_USED)),$(ZBRS_DATA)),                                    \
          '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))">'                                       \
          '\n      <Filter>Source</Filter>'                                                                     \
          '\n    </ClCompile>'                                                                                  \
   )                                                                                                     >> $@; \
   $(ECHOESC) $(foreach SRC,$(filter-out $(BRS_DATA) $(ZBRS_DATA),$(sort $(DATA_SOURCE_LST) $(MODULE_DATA_LST) $(MODULE_COMMON_LST))),                 \
          '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))">'                                       \
          '\n      <Filter>GenData</Filter>'                                                                    \
          '\n    </ClCompile>'                                                                                  \
   )                                                                                                     >> $@; \
   $(ECHOESC) $(foreach MODULE,$(filter-out BRS ZBRS OSEKOS,$(MODULE_USED_LST)),                                \
                $(foreach SRC,$(filter-out $(call _toLower,$(SOURCES_IN_LIBS)),$(call compSources,$(MODULE))),  \
                '\n    <ClCompile Include="$(ROOT)\\$(subst \,\\,$(subst /,\,$(SRC)))">'                                 \
                '\n      <Filter>$(call compName,$(MODULE))</Filter>'                                                            \
                '\n    </ClCompile>'                                                                            \
                )                                                                                               \
   )                                                                                                     >> $@; \
      $(ECHOESC) $(if $(findstring $(OSEKOS_USED),1),                                                           \
                $(if $(OSEKOS_$(PLATFORM)),                                                                     \
                    $(foreach SRC,$(OSEKOS_$(PLATFORM)),                                                        \
          '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))">'                                       \
          '\n      <Filter>OSEKOS</Filter>'                                                                     \
          '\n    </ClCompile>'                                                                                  \
                    )                                                                                           \
                    ,                                                                                           \
                    $(foreach SRC, $(OSEKOS_STAT_SRCS),                                                         \
          '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))">'                                       \
          '\n      <Filter>OSEKOS</Filter>'                                                                     \
          '\n    </ClCompile>'                                                                                  \
                    )                                                                                           \
                )                                                                                               \
   )                                                                                                     >> $@; \
   $(ECHO) '  </ItemGroup>'                                                                              >> $@; \
   $(ECHO) '  <ItemGroup>'                                                                               >> $@; \
   $(ECHOESC) $(foreach SRC,$(MAKESUPPORT_LIST),                                                                \
          '\n    <None Include="$(subst \,\\,$(subst /,\,$(SRC)))">'                                            \
          '\n      <Filter>MakeSupport</Filter>'                                                                \
          '\n    </None>'                                                                                       \
            )                                                                                            >> $@; \
   $(ECHOESC) $(foreach SRC, $(foreach SFX, $(ERR_SUFFIX_LIST),                                                 \
                 $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                           \
          '\n    <None Include="$(subst \,\\,$(subst /,\,$(ERR_PATH)\$(SRC)))">'                                \
          '\n      <Filter>Error files</Filter>'                                                                \
          '\n    </None>'                                                                                       \
   )                                                                                                     >> $@; \
   $(ECHOESC) '\n    <None Include="$(ERR_PATH)\\$(PROJECT_NAME).$(ERR_SUFFIX)">'                               \
            '\n      <Filter>Error files</Filter>'                                                              \
            '\n    </None>'                                                                              >> $@; \
      $(ECHOESC) $(foreach SRC, $(foreach SFX, $(LST_SUFFIX_LIST),                                              \
                 $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                           \
                '\n    <None Include="$(LST_PATH)\\$(SRC)">'                                                    \
                '\n      <Filter>List and Map Files</Filter>'                                                   \
                '\n    </None>'                                                                                 \
   )                                                                                                     >> $@; \
   $(ECHO) '    <None Include="$(PROJECT_NAME).map">'                                                     >> $@; \
   $(ECHO) '      <Filter>List and Map Files</Filter>'                                                    >> $@; \
   $(ECHO) '    </None>'                                                                                  >> $@; \
   $(ECHOESC) $(foreach SRC, $(foreach SFX, $(LST_SUFFIX_LIST),                                                  \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                            \
                '\n    <None Include="$(LOG_PATH)\\$(SRC)">'                                                    \
                '\n      <Filter>List and Map Files</Filter>'                                                   \
                '\n    </None>'                                                                                 \
   )                                                                                                     >> $@; \
   $(ECHO) '  </ItemGroup>'                                                                               >> $@; \
   $(ECHO) '  <ItemGroup>'                                                                                >> $@; \
   $(ECHOESC) $(foreach SRC,                                                                                    \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%_lint.txt,$(BUILD_OBJECTS)),                           \
                '\n    <None Include="$(LOG_PATH)\\$(SRC)">'                                                    \
                '\n      <Filter>PCLint Files</Filter>'                                                         \
                '\n    </None>'                                                                                 \
   )                                                                                                     >> $@; \
   $(ECHO) '  </ItemGroup>'                                                                              >> $@; \
   $(ECHO) '  <ItemGroup>'                                                                               >> $@; \
   $(foreach INC,$(subst \,\\,$(subst \ ,???,$(INCFILE_LIST))),                                                               \
   $(ECHOESC)    '\n    <ClInclude Include="$(subst ???, ,$(INC))">\n      <Filter>External Dependencies</Filter>\n    </ClInclude>'                                                     >> $@; \
  )                                                                                                             \
   $(ECHO) '  </ItemGroup>'                                                                              >> $@; \
   $(ECHO) '</Project>'                                                                                  >> $@; \
   $(ECHO) "...done";                                                           \
   $(ECHO) "";
   
#---------------------------------------------------------------------------------------------------------------- 
# vcxproj
#---------------------------------------------------------------------------------------------------------------- 

PREPROC_DEFS = EVA_BOARD_$(EVA_BOARD);                   \
               BRS_TIMEBASE_CLOCK=$(BRS_TIMEBASE_CLOCK); \
               QUARTZ_CLOCK=$(QUARTZ_CLOCK);             \
               C_DERIVATIVE_$(DERIVATIVE);               \
               _BRS_CPU_FREQUENCY=$(CPU_FREQUENCY);      \
               _BRS_QUARTZ_FREQUENCY=$(QUARTZ_FREQUENCY)

$(PROJECT_NAME)10.vcxproj: force
	@$(ECHO) "Generating Microsoft Visual Studio Project File: $@ ...";                                  \
	$(ECHO) '<?xml version="1.0" encoding="utf-8"?>'                                                      > $@; \
   $(ECHO) '<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">'   >> $@; \
   $(ECHO) '  <ItemGroup Label="ProjectConfigurations">'                                                 >> $@; \
   $(ECHO) '    <ProjectConfiguration Include="Debug|Win32">'                                            >> $@; \
   $(ECHO) '      <Configuration>Debug</Configuration>'                                                  >> $@; \
   $(ECHO) '      <Platform>Win32</Platform>'                                                            >> $@; \
   $(ECHO) '    </ProjectConfiguration>'                                                                 >> $@; \
   $(ECHO) '  </ItemGroup>'                                                                              >> $@; \
   $(ECHO) '  <PropertyGroup Label="Globals">'                                                           >> $@; \
   $(ECHO) '    <ProjectName>$(PROJECT_NAME)</ProjectName>'                                                    >> $@; \
   $(ECHO) '  </PropertyGroup>'                                                                          >> $@; \
   $(ECHO) '  <Import Project="$$(VCTargetsPath)\Microsoft.Cpp.Default.props" />'                         >> $@; \
   $(ECHO) "  <PropertyGroup Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\" Label=\"Configuration\">"        >> $@; \
   $(ECHO) '    <ConfigurationType>Makefile</ConfigurationType>'                                         >> $@; \
   $(ECHO) '  </PropertyGroup>'                                                                          >> $@; \
   $(ECHO) '  <Import Project="$$(VCTargetsPath)\Microsoft.Cpp.props" />'                                >> $@; \
   $(ECHO) '  <ImportGroup Label="ExtensionSettings">'                                                   >> $@; \
   $(ECHO) '  </ImportGroup>'                                                                            >> $@; \
   $(ECHO) "  <ImportGroup Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\" Label=\"PropertySheets\">"         >> $@; \
   $(ECHO) "    <Import Project=\""'$$(UserRootDir)'"\Microsoft.Cpp."'$$(Platform)'".user.props\" Condition=\"exists('"'$$(UserRootDir)'"\Microsoft.Cpp."'$$(Platform)'".user.props')\" Label=\"LocalAppDataPlatform\" />"         >> $@; \
   $(ECHO) '  </ImportGroup>'                                                                            >> $@; \
   $(ECHO) '  <PropertyGroup Label="UserMacros" />'                                                      >> $@; \
   $(ECHO) '  <PropertyGroup>'                                                                           >> $@; \
   $(ECHO) '    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>'                                 >> $@; \
   $(ECHO) "    <OutDir Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\">.\obj\</OutDir>"       >> $@; \
   $(ECHO) "    <IntDir Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\">.\obj\</IntDir>"       >> $@; \
   $(ECHO) "    <NMakeBuildCommandLine Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\">set ERR_TO_STDOUT=1 "'&amp;&amp; m.bat</NMakeBuildCommandLine>'                               >> $@; \
   $(ECHO) "    <NMakeReBuildCommandLine Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\">set ERR_TO_STDOUT=1 "'&amp;&amp; m.bat rebuild</NMakeReBuildCommandLine>'                   >> $@; \
   $(ECHO) "    <NMakeCleanCommandLine Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\">set ERR_TO_STDOUT=1 "'&amp;&amp; m.bat clean</NMakeCleanCommandLine>'                         >> $@; \
   $(ECHO) "    <NMakeOutput Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\">$(PROJECT_NAME).$(BINARY_SUFFIX)</NMakeOutput>"                                                         >> $@; \
   $(ECHO) "    <NMakeIncludeSearchPath Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\">$(subst /,\\,$(shell $(ECHO) $(GCCINC_LIST) | $(SED) 's/ /\;/g';))</NMakeIncludeSearchPath>" >> $@; \
   $(ECHO) "    <NMakePreprocessorDefinitions Condition=\"'"'$$(Configuration)|$$(Platform)'"'=='Debug|Win32'\">$(PREPROC_DEFS)</NMakePreprocessorDefinitions>" >> $@; \
   $(ECHO) '  </PropertyGroup>'                                                                          >> $@; \
   $(ECHO) '  <ItemDefinitionGroup>'                                                                     >> $@; \
   $(ECHO) '  </ItemDefinitionGroup>'                                                                    >> $@; \
   $(ECHO) '  <ItemGroup>'                                                                               >> $@; \
   $(ECHOESC) $(foreach SRC,$(APP_SOURCE_LST),                                                                  \
                '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))" />'                               \
    )                                                                                                    >> $@; \
   $(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(BRS_USED)),$(BRS_DATA)),                                      \
                '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))" />'                               \
   )                                                                                                     >> $@; \
   $(ECHOESC) $(foreach SRC,$(if $(findstring 1,$(ZBRS_USED)),$(ZBRS_DATA)),                                    \
                '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))" />'                               \
   )                                                                                                     >> $@; \
   $(ECHOESC) $(foreach SRC,$(filter-out $(BRS_DATA) $(ZBRS_DATA),$(sort $(DATA_SOURCE_LST) $(MODULE_DATA_LST) $(MODULE_COMMON_LST))),                 \
                '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))" />'                               \
   )                                                                                                     >> $@; \
   $(ECHOESC) $(foreach MODULE,$(filter-out BRS ZBRS OSEKOS,$(MODULE_USED_LST)),                                \
                $(foreach SRC,$(filter-out $(call _toLower,$(SOURCES_IN_LIBS)),$(call compSources,$(MODULE))),  \
                '\n    <ClCompile Include="$(ROOT)\\$(subst \,\\,$(subst /,\,$(SRC)))" />'                      \
                )                                                                                               \
   )                                                                                                     >> $@; \
   $(ECHOESC) $(if $(findstring $(OSEKOS_USED),1),                                                              \
                $(if $(OSEKOS_$(PLATFORM)),                                                                     \
                    $(foreach SRC,$(OSEKOS_$(PLATFORM)),                                                        \
                        '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))" />'                       \
                    )                                                                                           \
                    ,                                                                                           \
                    $(foreach SRC, $(OSEKOS_STAT_SRCS),                                                         \
                        '\n    <ClCompile Include="$(subst \,\\,$(subst /,\,$(SRC)))" />'                       \
                    )                                                                                           \
                )                                                                                               \
   )                                                                                                     >> $@; \
   $(ECHO) '  </ItemGroup>'                                                                              >> $@; \
   $(ECHO) '  <ItemGroup>'                                                                               >> $@; \
   $(ECHOESC) $(foreach SRC,$(MAKESUPPORT_LIST),                                                                \
                '\n    <None Include="$(subst \,\\,$(SRC))" />'                                                 \
            )                                                                                            >> $@; \
   $(ECHOESC) $(foreach SRC, $(foreach SFX, $(ERR_SUFFIX_LIST),                                                 \
                 $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                           \
                 '\n    <None Include="$(ERR_PATH)\\$(SRC)" />'                                                 \
   )                                                                                                     >> $@; \
   if [ $(ERR_OUTPUT)=="PIPE" ] ; then                                                                          \
      $(ECHO) '    <None Include="$(ERR_PATH)\$(PROJECT_NAME).$(ERR_SUFFIX)" />'                         >> $@; \
   fi;                                                                                                          \
   $(ECHOESC) $(foreach SRC, $(foreach SFX, $(LST_SUFFIX_LIST),                                                 \
                 $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),                           \
                 '\n    <None Include="$(LST_PATH)\\$(SRC)" />'                                                 \
   )                                                                                                     >> $@; \
   $(ECHO) '    <None Include="$(PROJECT_NAME).map" />'                                                  >> $@; \
   $(ECHOESC) $(foreach SRC,                                                                                    \
                $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%_lint.txt,$(BUILD_OBJECTS)),                           \
                '\n    <None Include="$(LOG_PATH)\\$(SRC)" />'                                                  \
   )                                                                                                     >> $@; \
   $(ECHO) '  </ItemGroup>'                                                                              >> $@; \
   $(ECHO) '  <ItemGroup>'                                                                               >> $@; \
   $(ECHOESC) $(subst ???, ,$(foreach INC,$(subst \,\\,$(subst \ ,???,$(INCFILE_LIST))),                        \
               '\n    <ClInclude Include="$(INC)" />'                                                           \
   )                                                                                                            \
   )                                                                                                     >> $@; \
   $(ECHO) '  </ItemGroup>'                                                                              >> $@; \
   $(ECHO) '  <Import Project="$$(VCTargetsPath)\Microsoft.Cpp.targets" />'                              >> $@; \
   $(ECHO) '  <ImportGroup Label="ExtensionTargets">'                                                    >> $@; \
   $(ECHO) '  </ImportGroup>'                                                                            >> $@; \
   $(ECHO) '</Project>   '                                                                               >> $@; \
   $(ECHO) "...done";                                                                                           \
   $(ECHO) "";
endif

endif

#-----------------------------------------------------------------------------
# SlickeEdit project file
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
slick: $(PROJECT_NAME).vpj $(PROJECT_NAME).vpw


$(PROJECT_NAME).vpw: force
	@$(ECHO) "Generating SlickEdit Workspace: $(PROJECT_NAME).vpw ..."; \
 $(ECHO) "[CurrentProject]"                                           > $@; \
 $(ECHO) "curproj=$(subst \,\\,$(CURDIR)\$(PROJECT_NAME)).vpj"       >> $@; \
 $(ECHO) "[ProjectFiles]"                                            >> $@; \
 $(ECHO) "$(PROJECT_NAME).vpj"                                       >> $@; \
 $(ECHO) "[State]"                                                   >> $@; \
 $(ECHO) "CWD: $(subst \,\\,$(CURDIR))"                              >> $@; \
 $(ECHO) "...done";                                                         \
 $(ECHO) "";


$(PROJECT_NAME).vpj: force
	@$(ECHO) "Generating SlickEdit Project File: $(PROJECT_NAME).vpj ...";                                                              \
 $(ECHO) "[COMPILER]"                                                                                                                 > $@; \
 $(ECHO) "version=5.0"                                                                                                               >> $@; \
 $(ECHO) "compile=concur|capture|hide|clear|savecurrent|:Compile:&Compile,set ERR_TO_STDOUT=1 && m.bat $(OBJ_PATH)\%n.$(OBJ_SUFFIX)" >> $@; \
 $(ECHO) "make=concur|capture|hide|clear|saveall|:Build:&Build,set ERR_TO_STDOUT=1 && m.bat"                                         >> $@; \
 $(ECHO) "rebuild=concur|capture|hide|clear|saveall|:Rebuild:&Rebuild,set ERR_TO_STDOUT=1 && b.bat"                                  >> $@; \
 $(ECHO) "debug=hide|:Debug:&Debug,"                                                                                                 >> $@; \
 $(ECHO) "execute=hide|:Execute:E&xecute,"                                                                                           >> $@; \
 $(ECHO) "user1=hide|:User 1:User 1,"                                                                                                >> $@; \
 $(ECHO) "user2=hide|:User 2:User 2,"                                                                                                >> $@; \
 $(ECHO) "usertool_clean=concur|capture|hide|clear|saveall|:Clean:&Clean,m.bat clean"                                                >> $@; \
 $(ECHO) "usertool_pclint=concur|capture|hide|clear|saveall|:PCLint:&PCLint,m.bat $(LOG_PATH)\%n_lint.txt"                           >> $@; \
 $(ECHO) "usertool_pclint_all=concur|capture|hide|clear|saveall|:PCLintAll:&PCLintAll,m.bat pclint"                                  >> $@; \
 $(ECHO) "usertool_preprocess=concur|capture|hide|clear|saveall|:PreProcess:&PreProcess,m.bat  $(LOG_PATH)\%n.%e"                    >> $@; \
 $(ECHO) "usertool_depend=concur|capture|hide|clear|saveall|:Depend:&Depend,m.bat depend"                                            >> $@; \
 $(ECHO) "usertool_version=concur|capture|hide|clear|saveall|:Version:&Version,m.bat version"                                        >> $@; \
 $(ECHO) "usertool_doxygen=concur|capture|hide|clear|saveall|:Doxygen:&Doxygen,m.bat doxygen"                                        >> $@; \
 $(ECHO) "workingdir=."                                                                                                              >> $@; \
 $(ECHO) "includedirs=$(subst -I,,$(subst \,\\,$(GCCINCLUDES)))"                                                                     >> $@; \
 $(ECHO) "reffile="                                                                                                                  >> $@; \
 $(ECHO) "MACRO=\\n"                                                                                                                 >> $@; \
 $(ECHO) "FILTERPATTERN=*.c\\n*.h\\n$(MAKESUPPORT_LIST_SEP)\\n$(ERR_LIST_SEP_WOP)\\n$(LST_N_MAP_LIST_SEP_WOP)\\n*_lint.txt\\n*.*\\n" >> $@; \
 $(ECHO) "FILTERNAME=Source Files\\nHeader Files\\nMakeSupport\\nError Files\\nList and Map Files\\nPCLint Files\\nOther Files\\n"   >> $@; \
 $(ECHO) "FILTERAPPCOMMAND=\\n\\n\\n\\n\\n\\n\\n"                                                                                    >> $@; \
 $(ECHO) "FILTERASSOCIATEFILETYPES=0 0 0 0 0 0 0 "                                                                                   >> $@; \
 $(ECHO) "[FILES]"                                                                                                                   >> $@; \
 for src in $(subst \,\\,$(SOURCES)); do                                                                                                    \
     $(ECHO) $$src                                                                                                                   >> $@; \
 done;                                                                                                                                      \
 for inc in $(subst \ ,???,$(subst \,\\,$(INCFILE_LIST))); do                                                                               \
     $(ECHO) $$inc | $(SED) 's/???/ /gp'                                                                                             >> $@; \
 done;                                                                                                                                      \
 for err in $(foreach SFX, $(ERR_SUFFIX_LIST),$(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))); do                       \
     $(ECHO) $(ERR_PATH)\\$$err                                                                                                      >> $@; \
 done;                                                                                                                                      \
 $(ECHO) "$(ERR_PATH)\$(PROJECT_NAME).$(ERR_SUFFIX)"                                                                                 >> $@; \
 for lst in $(foreach SFX, $(LST_SUFFIX_LIST),$(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))); do                       \
     $(ECHO) $(LST_PATH)\\$$lst                                                                                                      >> $@; \
 done;                                                                                                                                      \
 $(ECHO) $(if $(findstring $(OSEKOS_USED),1),"$(subst \,\\,$(SIMPLEOS_OIL))",)                                                       >> $@; \
 $(ECHO) ".\$(PROJECT_NAME).map"                                                                                                     >> $@; \
 for lint in $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%_lint.txt,$(BUILD_OBJECTS)); do                                                       \
     $(ECHO) $(LOG_PATH)\\$$lint                                                                                                     >> $@; \
 done;                                                                                                                                      \
 for mke in $(MAKESUPPORT_LIST); do                                                                                                         \
     $(ECHO) .\\$$mke                                                                                                                >> $@; \
 done;                                                                                                                                      \
 $(ECHO) "[ASSOCIATION]"                                                                                                             >> $@; \
 $(ECHO) "...done";                                                                                                                         \
 $(ECHO) "";
endif
#-----------------------------------------------------------------------------
# create CodeWright project file
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
codewright: del_codewright_pjt $(PROJECT_NAME).psp $(PROJECT_NAME).pjt

del_codewright_pjt: force
	@$(ECHO) "Deleting old Codewright Project Files/Directories:";                                    \
 $(ECHO) "    $(PROJECT_NAME).pjt, $(PROJECT_NAME).sbl, $(PROJECT_NAME).psp $(PROJECT_NAME).CS_";         \
 if [ -f $(PROJECT_NAME).pjt ] && [ -w $(PROJECT_NAME).pjt ]; then                                        \
     $(RM) $(PROJECT_NAME).pjt;                                                                           \
 fi;                                                                                                      \
 if [ -f $(PROJECT_NAME).sbl ] && [ -w $(PROJECT_NAME).sbl ]; then                                        \
     $(RM) $(PROJECT_NAME).sbl;                                                                           \
 fi;                                                                                                      \
 if [ -f $(PROJECT_NAME).psp ] && [ -w $(PROJECT_NAME).psp ]; then                                        \
     $(RM) $(PROJECT_NAME).psp;                                                                           \
 fi;                                                                                                      \
 if [ -d $(PROJECT_NAME).CS_ ] && [ -w $(PROJECT_NAME).CS_ ]; then                                        \
     $(RRM) $(PROJECT_NAME).CS_;                                                                          \
 fi;                                                                                                      \
 $(ECHO) "...done";                                                                                       \
 $(ECHO) "";

$(PROJECT_NAME).psp: force
	@$(ECHO) "Generating Codewright Project Space File: $(PROJECT_NAME).psp ...";                     \
 $(ECHO) ";Codewright Project Space File (do not remove or modify this line)"                       > $@; \
 $(ECHO) ""                                                                                        >> $@; \
 $(ECHO) "[State]"                                                                                 >> $@; \
 $(ECHO) ""                                                                                        >> $@; \
 $(ECHO) "[Project.\".\\$(PROJECT_NAME).pjt\"]"                                                    >> $@; \
 $(ECHO) "...done";                                                                                       \
 $(ECHO) "";

$(PROJECT_NAME).pjt: $(PROJECT_NAME).psp
	@$(ECHO) "Generating Codewright Project File: $(PROJECT_NAME).pjt ...";                           \
 $(ECHO) ";Codewright Project File (do not remove or modify this line)"                             > $@; \
 $(ECHO) ""                                                                                        >> $@; \
 $(ECHO) "[VersionControl:SourceSafe]"                                                             >> $@; \
 $(ECHO) ""                                                                                        >> $@; \
 $(ECHO) "[VersionControl:VCS]"                                                                    >> $@; \
 $(ECHO) ""                                                                                        >> $@; \
 $(ECHO) "[Tools]"                                                                                 >> $@; \
 $(ECHO) "ToolDeleteList"                                                                          >> $@; \
 $(ECHO) "ToolAddCmd='\$$_custom_tool_\$$_1','Organi',1342177584,"                                        \
             "'R:\CAN\Organi\Exec\conorg.exe'"                                                     >> $@; \
 $(ECHO) "ToolAddCmd='\$$_custom_tool_\$$_2','CANgen',1342177280,"                                        \
             "'D:\uti\cangen\exec\cangen'"                                                         >> $@; \
 $(ECHO) "ToolAddCmd='\$$_custom_tool_\$$_3','Lint with current file',1342177712,"                        \
             "'set CW_ACTIVE=1 && m.bat log\%f_lint.txt'"                                          >> $@; \
 $(ECHO) ""                                                                                        >> $@; \
 $(ECHO) "[Compiler]"                                                                              >> $@; \
 $(ECHOESC) "CompilerAddCmdEx='\$$_cw_proj_hash_\$$','',1073741824,'',0,"                                 \
            "'set ERR_TO_STDOUT=1 && m.bat',432,'set ERR_TO_STDOUT=1 && m.bat',432,"                      \
            "'set ERR_TO_STDOUT=1 && m.bat rebuild',432,'set ERR_TO_STDOUT=1 && m.bat rebuild',432,"      \
            "'',0,'',0,"                                                                                  \
            "'_ErrorInfoDefault','_PCLint1ErrorInfo','_PCLint2ErrorInfo',"                                \
            "'proj.err','%x'"                                                                      >> $@; \
 $(ECHO) ""                                                                                        >> $@; \
 $(ECHO) "[State]"                                                                                 >> $@; \
 $(ECHO) "SysSetCwd='$(subst /,\\,$(CURDIR))'"                                                     >> $@; \
 $(ECHO) ""                                                                                        >> $@; \
 $(ECHO) "[Editor]"                                                                                >> $@; \
 $(ECHO) "FilterProjDeleteList"                                                                    >> $@; \
 $(ECHO) "FilterProjAdd='Source','source\*.c;source\*.cpp;source\*.h;source\*.C;source\*.H;source\*.$(ASM_SUFFIX)',-1" >> $@; \
 $(ECHO) "FilterProjAdd='Include','include\*.c;include\*.cpp;include\*.h;include\*.C;include\*.H;include\*.$(ASM_SUFFIX)',-1" >> $@; \
 $(ECHO) "FilterProjAdd='GenData','$(GENDATA_DIR)\*.c;$(GENDATA_DIR)\*.cpp;$(GENDATA_DIR)\*.h;$(GENDATA_DIR)\*.C;$(GENDATA_DIR)\*.H;$(GENDATA_DIR)\*.$(ASM_SUFFIX)',-1" >> $@; \
 $(ECHOESC) $(if $(findstring $(OSEKOS_USED),1),                                                          \
                "\nFilterProjAdd='GenDataOs'$(_COMMA)"                                                    \
                "'$(GENDATA_OS_DIR)\*.c;$(GENDATA_OS_DIR)\*.cpp;$(GENDATA_OS_DIR)\*.h;$(GENDATA_OS_DIR)\*.C;$(GENDATA_OS_DIR)\*.H;$(GENDATA_OS_DIR)\*.$(ASM_SUFFIX);'$(_COMMA)-1" \
            )                                                                                      >> $@; \
 $(ECHOESC) $(foreach MODULE,$(filter-out BRS ZBRS OSEKOS,$(MODULE_USED_LST)),                                  \
                "\nFilterProjAdd='$(call compName,$(MODULE))',"                                                             \
                $(foreach DIR,$(subst \,\\,$(dir $(call compSources,$(MODULE)))),                                   \
                    "'$(DIR)*.c;$(DIR)*.cpp;$(DIR)*.h;$(DIR)*.C;$(DIR)*.H;$(DIR)\*.$(ASM_SUFFIX)'"        \
                )                                                                                         \
                ",-1"                                                                                     \
            )                                                                                      >> $@; \
 $(ECHOESC) $(if $(findstring $(OSEKOS_USED),1),                                                          \
                "\nFilterProjAdd='OSEKOS'$(_COMMA)"                                                       \
                $(foreach DIR,$(subst \,\\,$(dir $(OSEKOS_STAT_SRCS))),                                   \
                    "'$(if $(OSEKOS_$(PLATFORM)),,$(DIR)*.c;$(DIR)*.cpp;$(DIR)*.h;$(DIR)*.C;$(DIR)*.H;$(DIR)\*.$(ASM_SUFFIX);)*.oil'" \
                )                                                                                         \
                "$(_COMMA)-1",                                                                            \
            )                                                                                      >> $@; \
 $(ECHO) "FilterProjAdd='External Dependencies','*.c;*.cpp*.h;*.C;*.H;*.$(ASM_SUFFIX)',-1"         >> $@; \
 $(ECHO) "FilterProjAdd='MakeSupport','$(MAKESUPPORT_LIST_SEP)',-1"                                >> $@; \
 $(ECHO) "FilterProjAdd='Error Files','$(ERR_LIST_SEP)',-1"                                        >> $@; \
 $(ECHO) "FilterProjAdd='List and Map Files','$(LST_N_MAP_LIST_SEP)',-1"                           >> $@; \
 $(ECHO) "FilterProjAdd='PCLint Files','*_lint.txt',-1"                                            >> $@; \
 $(ECHO) ""                                                                                        >> $@; \
 $(ECHOESC) '[Files]' $(CW_FILES)                                                                  >> $@; \
 $(ECHO) "...done";                                                                                       \
 $(ECHO) "";

define CW_FILES
    $(foreach SRC,$(SOURCES),'\n$(subst \,\\,$(SRC))')                           \
    $(foreach SRC,$(ASM_SOURCES),'\n$(subst \,\\,$(SRC))')                       \
    $(subst ???, ,$(foreach INC,$(subst \,\\,$(subst \ ,???,$(INCFILE_LIST))),   \
        '\n$(subst /,\\,$(INC))'                                                 \
    ))                                                                           \
    $(foreach SRC, $(foreach SFX, $(ERR_SUFFIX_LIST),                            \
        $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),     \
        '\n$(ERR_PATH)\\$(SRC)'                                                  \
    )                                                                            \
    '\n$(subst \,\\,$(ERR_PATH)\$(PROJECT_NAME).$(ERR_SUFFIX))'                  \
    $(foreach SRC, $(foreach SFX, $(LST_SUFFIX_LIST),                            \
        $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%.$(SFX),$(BUILD_OBJECTS))),     \
        '\n$(LST_PATH)\\$(SRC)'                                                  \
    )                                                                            \
    $(if $(findstring $(OSEKOS_USED),1),'\n$(subst \,\\,$(SIMPLEOS_OIL))',)      \
    '\n.\\$(PROJECT_NAME).map'                                                   \
    $(if $(findstring $(OSEKOS_USED),1),                                         \
        $(if $(OSEKOS_$(PLATFORM)),,                                             \
            $(foreach SRC,$(subst \,\\,$(OSEKOS_STAT_SRCS)),'\n$(SRC)'),         \
        )                                                                        \
    )                                                                            \
    $(foreach SRC,                                                               \
        $(patsubst $(OBJ_PATH)\\%.$(OBJ_SUFFIX),%_lint.txt,$(BUILD_OBJECTS)),    \
        '\n$(LOG_PATH)\\$(SRC)'                                                  \
    )                                                                            \
    $(foreach SRC,$(MAKESUPPORT_LIST),                                           \
        '\n.\\$(SRC)'                                                            \
    )
endef
endif

#-----------------------------------------------------------------------------
# ant project file
# needed variables: ANT_COMPILERNAME
# optional variables: ANT_ADDITIONAL
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)

XML_CFLAGS=$(subst $(_DQUOTE),&quot;,$(CFLAGS))
XML_ASFLAGS=$(subst $(_DQUOTE),&quot;,$(ASFLAGS))

build.xml: force
	@$(ECHO) "Generating ant script: build.xml ...";                           \
 $(ECHO) '<?xml version="1.0" encoding="utf-8"?>'                                                                          > $@; \
 $(ECHO) '<project name="$(PROJECT_NAME)" default="compile" xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks">'           >> $@; \
 $(ECHO) '  <taskdef name="preprocessor" classname="org.anarres.cpp.ant.PreprocessorTask" />'                              >> $@; \
 $(ECHO) '  <macrodef name="build">'                                                                                       >> $@; \
 $(ECHO) '    <attribute name="outtype" />'                                                                                >> $@; \
 $(ECHO) '    <attribute name="outfile" />'                                                                                >> $@; \
 $(ECHO) '    <attribute name="debug" />'                                                                                  >> $@; \
 $(ECHO) '    <attribute name="filelist" />'                                                                               >> $@; \
 $(ECHO) '    <sequential>'                                                                                                >> $@; \
 $(ECHO) '      <cpptasks:cc name="$(ANT_COMPILERNAME)" outtype="@{outtype}" subsystem="console" outfile="@{outfile}" objdir="$(OBJ_PATH)" debug="@{debug}" libdir="lib" lstdir="$(LST_PATH)" errdir="$(ERR_PATH)" runtime="static">'  >> $@; \
 $(ECHO) '        <filelist refid="@{filelist}" />'                                                                        >> $@;
	@$(foreach CFLAG,$(XML_CFLAGS),$(if $(findstring /F,$(CFLAG)),, \
	$(ECHO) '        <compilerarg value ="$(CFLAG)"/>'                                                                        >> $@; \
 ))
	@$(foreach ASFLAG,$(XML_ASFLAGS), \
 $(ECHO) '        <assemblerarg value ="$(ASFLAG)"/>'                                                                      >> $@; \
 )
	@$(ECHO) '        <includepath>'                                                                                           >> $@; \
 $(foreach DIR,$(GCCINC_LIST), \
 $(ECHO) '          <dirset dir="$(subst ???, ,$(DIR))"/>'                                                                 >> $@; \
 )
	@$(ECHO) '        </includepath>'                                                                                          >> $@; \
 $(ANT_ADDITIONAL) \
 $(ECHO) '      </cpptasks:cc>'                                                                                            >> $@; \
 $(ECHO) '      <copy file="@{outfile}.dll" todir="../Canoe/Exec32" />'                                                    >> $@; \
 $(ECHO) '    </sequential>'                                                                                               >> $@; \
 $(ECHO) '  </macrodef>'                                                                                                   >> $@; \
 $(ECHO) '  <filelist id="$(PROJECT_NAME).sources">'                                                                       >> $@; \
 $(foreach SOURCE,$(SOURCES_UNIX), \
 $(ECHO) '    <file name="$(SOURCE)"/>'                                                                                    >> $@; \
 )
	@$(ECHO) '  </filelist>'                                                                                                   >> $@;
	@$(ECHO) '  <target name="compile">'                                                                                       >> $@; \
 $(ECHO) '    <mkdir dir="$(OBJ_PATH)"/>'                                                                                  >> $@; \
 $(ECHO) '    <build outtype="shared" outfile="$(PROJECT_NAME)" debug="true" filelist="$(PROJECT_NAME).sources"/>'     >> $@; \
 $(ECHO) '  </target>'                                                                                                     >> $@; \
 $(ECHO) '</project>'                                                                                                      >> $@; \
 $(ECHO) '...done';                                                                                \
 $(ECHO) "";

endif

#-----------------------------------------------------------------------------
# Preparation for QAC Misra
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
MISRA_REPORTS       = $(foreach MODULE,$(MODULE_USED_LST),misra\$(MODULE)_report.txt)
MISRA_MERGE_REPORTS = $(foreach MODULE,$(MODULE_USED_LST),misra\$(MODULE)_merge_reports)
MISRA_PROJECTS      = $(foreach MODULE,$(MODULE_USED_LST),misra\$(MODULE)_misra.prj)

qac_common_prerequisites: $(PROJECT_NAME).p_a         \
                          $(PROJECT_NAME).p_c         \
                          all_MISRA_rules_QAC70.p_s   \
                          qacinfo                     \
                          misra                       \
                          misra/tmp

#-----------------------------------------------------------------------------
# create QAC Misra checker config files
#-----------------------------------------------------------------------------
qac: $(PROJECT_NAME)_misra.prj   \
     all_MISRA_rules_QAC70.p_s   \
     qac_common_prerequisites

qacinfo: force
	@$(ECHO) "You have to copy your compiler includes to $(QAC_CC_INCLUDE) in order to run QAC successfully!"; \
 $(ECHO) "";

misra:
	@$(MKDIR) misra

misra/tmp:
	@$(MKDIR) misra/tmp

ifeq ($(QAC_CC_INCLUDE),)
  QAC_CC_INCLUDE = $(ROOT)\system
endif

ifeq ($(QAC_INCLUDES),)
    QAC_INCLUDES=       $(COMMON_INC)         \
                        $(FBLCAN_INC)         \
                        include               \
                        $(GENDATA_DIR)        \
                        $(SUBDIRS)
endif

QAC_INCLUDE_LIST = $(subst \,/,$(subst \ ,???, \
                    $(QAC_INCLUDES)           \
                    $(ADDITIONAL_INCLUDES)    \
                    $(QAC_CC_INCLUDE)))

QAC_INCLUDES_1 = $(subst ???,\ ,$(addprefix -I, $(sort $(call toLower,QAC_INCLUDE_LIST))))
QAC_INCLUDES_2 = $(subst \ ,???,$(subst /,\\,$(subst -I,,$(QAC_INCLUDES_1))))
QAC_INCLUDES_3   = $(subst ???, ,$(foreach FILE,$(QAC_INCLUDES_2),\n-i $(if $(findstring :\\,$(FILE)),$(FILE),"$(QAC_CURDIR)\\$(FILE)")))

QAC_SYSTEM_1 = $(subst \,/,$(subst \ ,???,$(ROOT)\system))
QAC_SYSTEM_2 = $(subst ???,\ ,$(addprefix -I, $(sort $(call toLower,QAC_SYSTEM_1))))
QAC_SYSTEM_3 = $(subst \ ,???,$(subst /,\\,$(subst -I,,$(QAC_SYSTEM_2))))
QAC_SYSTEM   = $(subst ???, ,$(foreach FILE,$(QAC_SYSTEM_3),\n-I "$(QAC_CURDIR)\\$(FILE)"))

# Suppress these files in Qac report

QAC_SUPPRESS  = $(subst \,/,$(subst \ ,???, \
                        $(QAC_SUPPRESS_OUT_DIR) \
                        $(QAC_SUPPRESS_OUT_FILE)))
                                               
QAC_SUPPRESS_1 = $(subst ???,\ ,$(addprefix -Q, $(sort $(call toLower,QAC_SUPPRESS))))
QAC_SUPPRESS_2 = $(subst \ ,???,$(subst /,\\,$(subst -Q,,$(QAC_SUPPRESS_1))))
QAC_SUPPRESS_3   = $(subst ???, ,$(foreach FILE,$(QAC_SUPPRESS_2),\n-Q $(if $(findstring :\\,$(FILE)),$(FILE),"$(QAC_CURDIR)\\$(FILE)")))

QAC_CURDIR = $(subst \,\\,$(CURDIR))

ifeq ($(QAC_PERSONALITY),)
    QAC_WARNING = "Warning: QAC Compiler personality generation is not implemented for this platform. Settings must be adjusted manually!\n\n"
endif

ifeq ($(QAC_SUPPRESS_HEADERS),)
    QAC_HEADER_SETTING  = "-HDR-"
else
    QAC_HEADER_INCLUDES = $(subst -i,-q,$(QAC_INCLUDES_3))
    QAC_HEADER_SETTING  = "-HDR+"
endif

ifeq ($(MESSAGE_PERSONALITY_FILE_LOCATION),)
MESSAGE_PERSONALITY_FILE_LOCATION  = \\\\vi.vector.int\\Backup\\PES\\DevelopmentTools\\others\\PRQA\\automation\\report\\all_MISRA_rules_QAC70.p_s
endif
ifeq ($(QACTOOL_PATH),)
QACTOOL_PATH = \\\\vi.vector.int\\Backup\\PES\\DevelopmentTools\\others\\PRQA\\automation\\report\\QAC7.0
endif

$(PROJECT_NAME).p_a: Makefile Makefile.project.part.defines Makefile.config $(PROJECT_NAME).dep
	@$(ECHO) "Generating QAC7 project file: $@ ...";                      \
 $(ECHO) "-il 0"                                                 > $@; \
 $(ECHOESC) '$(QAC_INCLUDES_3)'                                 >> $@; \
 $(ECHOESC) '$(QAC_HEADER_INCLUDES)'                            >> $@; \
 $(ECHOESC) '$(QAC_SUPPRESS_3)'                                 >> $@; \
 $(ECHO) "-sty exdented"                                        >> $@; \
 $(ECHO) "-tab 2"                                               >> $@; \
 $(ECHO) "-wc abort=5126"                                       >> $@; \
 $(ECHO) "-wc asctime=5127"                                     >> $@; \
 $(ECHO) "-wc atof=5125"                                        >> $@; \
 $(ECHO) "-wc atoi=5125"                                        >> $@; \
 $(ECHO) "-wc atol=5125"                                        >> $@; \
 $(ECHO) "-wc calloc=5118"                                      >> $@; \
 $(ECHO) "-wc clock=5127"                                       >> $@; \
 $(ECHO) "-wc ctime=5127"                                       >> $@; \
 $(ECHO) "-wc difftime=5127"                                    >> $@; \
 $(ECHO) "-wc exit=5126"                                        >> $@; \
 $(ECHO) "-wc free=5118"                                        >> $@; \
 $(ECHO) "-wc getenv=5126"                                      >> $@; \
 $(ECHO) "-wc gmtime=5127"                                      >> $@; \
 $(ECHO) "-wc localtime=5127"                                   >> $@; \
 $(ECHO) "-wc longjmp=5122"                                     >> $@; \
 $(ECHO) "-wc malloc=5118"                                      >> $@; \
 $(ECHO) "-wc mktime=5127"                                      >> $@; \
 $(ECHO) "-wc raise=5123"                                       >> $@; \
 $(ECHO) "-wc realloc=5118"                                     >> $@; \
 $(ECHO) "-wc signal=5123"                                      >> $@; \
 $(ECHO) "-wc strftime=5127"                                    >> $@; \
 $(ECHO) "-wc system=5126"                                      >> $@; \
 $(ECHO) "-wc time=5127"                                        >> $@; \
 $(ECHO) "-en ASC"                                              >> $@; \
 $(ECHO) "-maxerr 0"                                            >> $@; \
 $(ECHO) "-ppl+"                                                >> $@; \
 $(ECHO) "-ppf+"                                                >> $@; \
 $(ECHO) "-met+"                                                >> $@; \
 $(ECHO) "-ppm-"                                                >> $@; \
 $(ECHO) "-co a"                                                >> $@; \
 $(ECHO) "-k+r gs"                                              >> $@; \
 $(ECHO) "-thresh \"STPTH>80:6010\""                            >> $@; \
 $(ECHO) "-thresh \"STCYC>10:6030\""                            >> $@; \
 $(ECHO) "-thresh \"STCAL>7:6050\""                             >> $@; \
 $(ECHO) "-thresh \"STPAR>5:6060\""                             >> $@; \
 $(ECHO) "-thresh \"STMIF>4:6080\""                             >> $@; \
 $(ECHO) "-thresh \"STBAK>0:6150\""                             >> $@; \
 $(ECHO) "-ss+"                                                 >> $@; \
 $(ECHO) "-sr-"                                                 >> $@; \
 $(ECHO) "-mll 0"                                               >> $@; \
 $(ECHO) "...done";                                                    \
 $(ECHO) "";

$(PROJECT_NAME).p_c: Makefile Makefile.config
	@$(ECHO) "Generating QAC7 compiler configuration file: $@ ..."; \
 $(ECHOESC) '$(QAC_SYSTEM)'                                      > $@; \
 $(ECHOESC) '$(subst -I,-Q,$(QAC_SYSTEM))'                      >> $@; \
 $(QAC_PERSONALITY)                                                    \
 $(ECHO) "...done";                                                    \
 $(ECHO) "";                                                           \
 $(ECHOESC) $(QAC_WARNING);

QC=$(QAC_CURDIR)
QCP=$(QAC_CURDIR)\\$(PROJECT_NAME)
export QC
export QCP

$(PROJECT_NAME)_misra.prj: Makefile Makefile.project.part.defines Makefile.config $(PROJECT_NAME).dep
	@$(ECHO) "Generating QAC7 linker configuration file: $@ ..."; \
 $(ECHOESC) 'VersionTag45\n' \
            'StartProjectMarker\n' \
            'FolderName=$(PROJECT_NAME)\n' \
            'SourcePath='"$$QC"'\n'                                                  \
            'OutputPath='"$$QC"'\\misra\\tmp\n'                                      \
            'SubsPers='"$$QC"'\\all_MISRA_rules_QAC70.p_s\n' \
            'AnalPers='"$$QCP"'.p_a\n' \
            'CompPers='"$$QCP"'.p_c\n' \
            'EndContainedFilesMarker\n' \
            'StartSubProjectMarker\n' \
            'StartProjectMarker\n' \
            'FolderName=Source\n' \
            'SourcePath='"$$QC"'\n'                                                  \
            'OutputPath='"$$QC"'\\misra\\tmp\n'                                      \
            'SubsPers='"$$QC"'\\all_MISRA_rules_QAC70.p_s\n' \
            'AnalPers='"$$QCP"'.p_a\n' \
            'CompPers='"$$QCP"'.p_c\n'                               > $@
	@$(foreach FILE,$(APP_SOURCE_LST) $(filter-out 0,$(subst 1,$(ZBRS_DATA),$(ZBRS_USED))), \
	$(ECHOESC) "$$QC"'\\$(subst \,\\,$(FILE))\n' >>$@; )
	@$(ECHOESC) 'EndContainedFilesMarker\n' \
            'StartProjectMarker\n' \
            'FolderName=GenData\n' \
            'SourcePath='"$$QC"'\\\n' \
            'OutputPath='"$$QC"'\\misra\\tmp\n'                                      \
            'SubsPers='"$$QC"'\\all_MISRA_rules_QAC70.p_s\n' \
            'AnalPers='"$$QCP"'.p_a\n' \
            'CompPers='"$$QCP"'.p_c\n' >>$@
	@$(foreach FILE,$(subst \,\\,$(sort $(DATA_SOURCE_LST) $(MODULE_DATA_LST) $(MODULE_COMMON_LST))), \
	$(ECHOESC) "$$QC"'\\$(FILE)\n' >>$@ ; ) \
$(foreach GROUP,$(filter-out BRS ZBRS,$(MODULE_USED_LST)), \
                $(foreach DATA,$($(GROUP)_DATA), \
$(ECHOESC) "$$QC"'\\$(subst \,\\,$(DATA))\n' >>$@ ; \
                 ) \
) >>$@ 
	@$(ECHOESC) 'EndContainedFilesMarker\n' \
            $(foreach GROUP,$(filter-out BRS ZBRS,$(MODULE_USED_LST)), \
                'StartProjectMarker\n'                                                    \
                'FolderName=$(GROUP)\n'                                                   \
                'SourcePath='"$$QC"'\n'                                              \
                'OutputPath='"$$QC"'\\misra\\tmp\\\n'                                \
                'SubsPers='"$$QC"'\\all_MISRA_rules_QAC70.p_s\n'                     \
                'AnalPers='"$$QCP"'.p_a\n'                           \
                'CompPers='"$$QCP"'.p_c\n'                           \
                $(foreach FILE,$(subst \,\\,$(call compSources,$(GROUP))), \
                    "$$QC"'\\$(ROOT)\\$(FILE)\n' \
                ) \
                'EndContainedFilesMarker\n' \
            ) \
            'EndSubProjectMarker\n' >> $@;
	@$(MV) $@ "$@.tmp" && $(SED) -n 's/^[ ]*//p' < "$@.tmp" > $@ && $(RM) "$@.tmp"
	@$(ECHO) "...done";
	@$(ECHO) ""

$(subst /,\,$(MISRA_PROJECTS)) : misra\\%_misra.prj: misra/%_misra.prj

.PRECIOUS: misra/%_misra.prj

misra/%_misra.prj: Makefile Makefile.project.part.defines Makefile.config $(PROJECT_NAME).dep
	@$(ECHO) "Generating QAC7 configuration file: $@ ..."; \
 $(ECHOESC) 'VersionTag45\n' \
            'StartProjectMarker\n' \
            'FolderName=$*\n' \
            'SourcePath='"$$QC"'\\\n' \
            'OutputPath='"$$QC"'\\misra\\tmp\\\n' \
            'SubsPers='"$$QC"'\\all_MISRA_rules_QAC70.p_s\n' \
            'AnalPers='"$$QCP"'.p_a\n' \
            'CompPers='"$$QCP"'.p_c\n' \
            $(foreach FILE,$(subst \,\\,$(call compSources,$(call _toUpper,$*))), \
                "$$QC\\$(ROOT)\\$(FILE)\n" \
            ) \
            $(foreach FILE,$(subst \,\\,$($(call _toUpper,$*_DATA))), \
                "$$QC\\$(FILE)\n" \
            ) \
            'EndContainedFilesMarker\n' | $(SED) -n 's/^[ ]*\(.*\)/\1/p'            > $@; \
 $(ECHO) "...done"; \
 $(ECHO) ""

all_MISRA_rules_QAC70.p_s: Makefile Makefile.project.part.defines Makefile.config $(PROJECT_NAME).dep
	@$(ECHO) "Generating QAC deviation list file: $@ ..."; \
 $(ECHO) "-rem \"EnablePostAnalysis=1\""                          > $@; \
 $(ECHO) "-rem \"ShellExe=$(QAC_PATH)\m2cm\bin\qacsa_m2cm.exe\"" >> $@; \
 $(ECHO) "-rem \"ShellParams=%Q %F -forget cmaf\""               >> $@; \
 $(ECHO) "-UP \"$(QAC_PATH)\m2cm\messages\\\""                   >> $@; \
 $(ECHO) "-USR .m2cm"                                            >> $@; \
 $(ECHO) "-SUMM-"                                                >> $@; \
 $(ECHO) "$(QAC_HEADER_SETTING)"                                 >> $@; \
 $(ECHO) "-REF+"                                                 >> $@; \
 $(ECHO) "-ONE-"                                                 >> $@; \
 $(ECHO) "-TEXT-"                                                >> $@; \
 $(CAT) $(MESSAGE_PERSONALITY_FILE_LOCATION)                     >> $@; \
 $(ECHO) "...done"; \
 $(ECHO) "";

#---------------------------------------------------------------------
 # run_qac sets the Environment necessary for qac and starts it over the commandline.
#---------------------------------------------------------------------
$(subst /,\,$(MISRA_REPORTS)) : misra\\%_report.txt: misra/%_report.txt

misra/%_report.txt: qac_common_prerequisites misra/%_misra.prj
	@export LM_LICENSE_FILE=$(QAC_LICENSE_SRV);                                          \
 export QACPATH=$(subst \,\\,"$(QAC_PATH)")\\;                                               \
 export QACBIN=$(subst \,\\,"$(QAC_PATH))"\\bin\\;                                           \
 export QACOUTPATH=$(subst \,\\,$(CURDIR))\\misra\\tmp\\;                                    \
 export QACHELPFILES=$(subst \,\\,"$(QAC_PATH)")\\help\\;                                    \
 export QACTEMP=$(subst \,\\,$(CURDIR))\\misra\\tmp\\;                                       \
 export PATH='/cygdrive/$(subst / ,\ ,$(subst :,,$(subst \,/,$(QAC_PATH))/bin)):/cygdrive/$(subst / ,\ ,$(subst :,,$(subst \,/,$(QAC_PATH))/m2cm/bin)):/cygdrive/c\WINDOWS\system32:$$PATH';\
 $(ECHO) "... performing MISRA analysis on component $*";                                    \
 qaw qac misra\\$*_misra.prj -maseq "pal %Q %P+ %L+" -etxt -fdisp qacoutput.txt;                   \
 $(ECHO) "... extracting qac version";                                                       \
 prjdsp QAC -ver $(VIA)  2>/dev/null 1>tmp1.txt;                                             \
 $(ECHO) "... running prjdsp";                                                               \
 prjdsp QAC $(VIA) $(call misraReportFiles,$*) > tmp2.txt;                  \
 $(ECHO) "... converting results (execute qactool)";                                         \
 $(ECHOESC) $(foreach FILE,$(addprefix .\\misra\\tmp\\,$(notdir $(call compSources,$(call _toUpper,$*)))),         \
                '$(FILE)\n'                                       \
            )  > inputfile.txt; \
 $(QACTOOL_PATH)/QACTool2.exe -c2 inputfile.txt;                                             \
 $(ECHO) "... merging reports";                                                              \
 $(CAT) tmp1.txt tmp2.txt QACtool.metric.txt > misra/$*_report.txt;                          \
 $(RM) inputfile.txt tmp1.txt tmp2.txt;

misraReportFiles = $(subst \,\\,$(call compSources,$(call _toUpper,$1))) \
                    \\misra\\tmp\\$1 \
                    $(addprefix \\misra\\tmp\\,$(notdir $($1_DATA)))

$(subst /,\,$(MISRA_MERGE_REPORTS)) : misra\\%_merge_reports: misra/%_merge_reports

misra/%_merge_reports:
	@if [ -z "$(MISRA_REPORT_DIR_LST)" ] ; then                                                                       \
     $(ECHO) "MISRA_REPORT_DIR_LST is not set. Please add all directories (containing the report file $*_report.txt) to the variable which should be used for the merged report"; \
     exit 1;                                                                                                              \
 else                                                                                                                     \
     $(ECHO) "Merging all reports from <$(MISRA_REPORT_DIR_LST)> to QACtool.MergedReports.txt";                           \
     $(ECHOESC) $(foreach DIR,$(MISRA_REPORT_DIR_LST),                                                                    \
                    '$(subst \,\\,$(DIR))\\$*_report.txt\n'                                                               \
                )                                                                                       >> inputfile.txt; \
     $(QACTOOL_PATH)/qactool2 -m inputfile.txt;                                                                           \
     $(RM) inputfile.txt;                                                                                                 \
     $(ECHO) "...done";                                                                                                   \
 fi

VIA = -via all_MISRA_rules_QAC70.p_s \
      -via $(PROJECT_NAME).p_a \
      -via $(PROJECT_NAME).p_c \
      -op misra\\tmp
endif
##############################################################################
# Doc
##############################################################################
ifeq ($(QUICKBUILD),)
DOXYGEN = $(CMD_PATH)/doxygen/doxygen

DOXYGEN_EXCL_DIRS  += $(COMPILER_BASE) $(COMPILER_INC) $(COMPILER_BIN) $(COMPILER_LIB)
DOXYGEN_EXCL_DIRS_  = $(subst \ ,???,$(DOXYGEN_EXCL_DIRS))
DOXYGEN_EXCL_FILES_ = $(subst \ ,???,$(DOXYGEN_EXCL_FILES))

DOXYGEN_INPUT   = $(foreach FILE, \
                      $(sort $(filter-out \
                          $(subst \,/,$(call _toLower,$(DOXYGEN_EXCL_FILES_)                       \
                                          $(addsuffix /%.c,$(DOXYGEN_EXCL_DIRS_))                  \
                                          $(addsuffix /%.$(ASM_SUFFIX),$(DOXYGEN_EXCL_DIRS_))      \
                                          $(addsuffix /%.h,$(DOXYGEN_EXCL_DIRS_)))),               \
                          $(subst \,/,$(call _toLower,$(subst \ ,???,$(SOURCES) $(INCFILE_LIST)))) \
                      )),                                                                          \
                      \"$(subst ???, ,$(FILE))\"                                                   \
                  )
DOXYGEN_INCLUDE = $(foreach DIR, \
                      $(filter-out \
                          $(call _toLower,$(subst \\,/,$(subst \ ,???,$(DOXYGEN_EXCL_DIRS)))), \
                          $(subst \\,/,$(subst \ ,???,$(VERSION_DIR)))), \
                      \"$(subst ???, ,$(DIR)\") \
                  )

doxygen: $(PROJECT_NAME).doc.cfg
	@if [ -f $(DOXYGEN) ] ; then            \
     $(RM) -rf docs;                            \
     $(MKDIR) docs;                             \
     $(DOXYGEN) $(PROJECT_NAME).doc.cfg;        \
 else                                           \
     $(ECHO) "Doxygen not installed properly";  \
 fi;

$(PROJECT_NAME).doc.cfg: $(PROJECT_NAME).dep
	@$(ECHO) "Generating $@ ...";                                                          \
 $(ECHO) "# Doxyfile 1.5.5"                                                              > $@; \
 $(ECHO) ""                                                                             >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# Project related configuration options"                                      >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "DOXYFILE_ENCODING      = UTF-8"                                               >> $@; \
 $(ECHO) "PROJECT_NAME           = $(PROJECT_NAME)"                                     >> $@; \
 $(ECHO) "PROJECT_NUMBER         = "                                                    >> $@; \
 $(ECHO) "OUTPUT_DIRECTORY       = ."                                                   >> $@; \
 $(ECHO) "CREATE_SUBDIRS         = NO"                                                  >> $@; \
 $(ECHO) "OUTPUT_LANGUAGE        = English"                                             >> $@; \
 $(ECHO) "BRIEF_MEMBER_DESC      = YES"                                                 >> $@; \
 $(ECHO) "REPEAT_BRIEF           = YES"                                                 >> $@; \
 $(ECHO) "ABBREVIATE_BRIEF       = \"The \$$name class\" \\"                            >> $@; \
 $(ECHO) "                         \"The \$$name widget\" \\"                           >> $@; \
 $(ECHO) "                         \"The \$$name file\" \\"                             >> $@; \
 $(ECHO) "                         is \\"                                               >> $@; \
 $(ECHO) "                         provides \\"                                         >> $@; \
 $(ECHO) "                         specifies \\"                                        >> $@; \
 $(ECHO) "                         contains \\"                                         >> $@; \
 $(ECHO) "                         represents \\"                                       >> $@; \
 $(ECHO) "                         a \\"                                                >> $@; \
 $(ECHO) "                         an \\"                                               >> $@; \
 $(ECHO) "                         the"                                                 >> $@; \
 $(ECHO) "ALWAYS_DETAILED_SEC    = NO"                                                  >> $@; \
 $(ECHO) "INLINE_INHERITED_MEMB  = NO"                                                  >> $@; \
 $(ECHO) "FULL_PATH_NAMES        = NO"                                                  >> $@; \
 $(ECHO) "STRIP_FROM_PATH        = "                                                    >> $@; \
 $(ECHO) "STRIP_FROM_INC_PATH    = "                                                    >> $@; \
 $(ECHO) "SHORT_NAMES            = NO"                                                  >> $@; \
 $(ECHO) "JAVADOC_AUTOBRIEF      = NO"                                                  >> $@; \
 $(ECHO) "QT_AUTOBRIEF           = NO"                                                  >> $@; \
 $(ECHO) "MULTILINE_CPP_IS_BRIEF = NO"                                                  >> $@; \
 $(ECHO) "DETAILS_AT_TOP         = NO"                                                  >> $@; \
 $(ECHO) "INHERIT_DOCS           = YES"                                                 >> $@; \
 $(ECHO) "SEPARATE_MEMBER_PAGES  = NO"                                                  >> $@; \
 $(ECHO) "TAB_SIZE               = 2"                                                   >> $@; \
 $(ECHO) "ALIASES                = \"param_i=\\par Parameter Indexed:\\n\" \\"          >> $@; \
 $(ECHO) "                         \"context=\\par Call Context:\\n\""                  >> $@; \
 $(ECHO) "OPTIMIZE_OUTPUT_FOR_C  = YES"                                                 >> $@; \
 $(ECHO) "OPTIMIZE_OUTPUT_JAVA   = NO"                                                  >> $@; \
 $(ECHO) "OPTIMIZE_FOR_FORTRAN   = NO"                                                  >> $@; \
 $(ECHO) "OPTIMIZE_OUTPUT_VHDL   = NO"                                                  >> $@; \
 $(ECHO) "BUILTIN_STL_SUPPORT    = NO"                                                  >> $@; \
 $(ECHO) "CPP_CLI_SUPPORT        = NO"                                                  >> $@; \
 $(ECHO) "SIP_SUPPORT            = NO"                                                  >> $@; \
 $(ECHO) "DISTRIBUTE_GROUP_DOC   = YES"                                                 >> $@; \
 $(ECHO) "SUBGROUPING            = YES"                                                 >> $@; \
 $(ECHO) "TYPEDEF_HIDES_STRUCT   = NO"                                                  >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# Build related configuration options"                                        >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "EXTRACT_ALL            = YES"                                                 >> $@; \
 $(ECHO) "EXTRACT_PRIVATE        = YES"                                                 >> $@; \
 $(ECHO) "EXTRACT_STATIC         = YES"                                                 >> $@; \
 $(ECHO) "EXTRACT_LOCAL_CLASSES  = YES"                                                 >> $@; \
 $(ECHO) "EXTRACT_LOCAL_METHODS  = YES"                                                 >> $@; \
 $(ECHO) "EXTRACT_ANON_NSPACES   = YES"                                                 >> $@; \
 $(ECHO) "HIDE_UNDOC_MEMBERS     = NO"                                                  >> $@; \
 $(ECHO) "HIDE_UNDOC_CLASSES     = NO"                                                  >> $@; \
 $(ECHO) "HIDE_FRIEND_COMPOUNDS  = NO"                                                  >> $@; \
 $(ECHO) "HIDE_IN_BODY_DOCS      = NO"                                                  >> $@; \
 $(ECHO) "INTERNAL_DOCS          = NO"                                                  >> $@; \
 $(ECHO) "CASE_SENSE_NAMES       = NO"                                                  >> $@; \
 $(ECHO) "HIDE_SCOPE_NAMES       = NO"                                                  >> $@; \
 $(ECHO) "SHOW_INCLUDE_FILES     = YES"                                                 >> $@; \
 $(ECHO) "INLINE_INFO            = YES"                                                 >> $@; \
 $(ECHO) "SORT_MEMBER_DOCS       = NO"                                                  >> $@; \
 $(ECHO) "SORT_BRIEF_DOCS        = NO"                                                  >> $@; \
 $(ECHO) "SORT_GROUP_NAMES       = NO"                                                  >> $@; \
 $(ECHO) "SORT_BY_SCOPE_NAME     = NO"                                                  >> $@; \
 $(ECHO) "GENERATE_TODOLIST      = YES"                                                 >> $@; \
 $(ECHO) "GENERATE_TESTLIST      = YES"                                                 >> $@; \
 $(ECHO) "GENERATE_BUGLIST       = YES"                                                 >> $@; \
 $(ECHO) "GENERATE_DEPRECATEDLIST= YES"                                                 >> $@; \
 $(ECHO) "ENABLED_SECTIONS       = "                                                    >> $@; \
 $(ECHO) "MAX_INITIALIZER_LINES  = 30"                                                  >> $@; \
 $(ECHO) "SHOW_USED_FILES        = YES"                                                 >> $@; \
 $(ECHO) "SHOW_DIRECTORIES       = YES"                                                 >> $@; \
 $(ECHO) "FILE_VERSION_FILTER    = "                                                    >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to warning and progress messages"             >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "QUIET                  = NO"                                                  >> $@; \
 $(ECHO) "WARNINGS               = YES"                                                 >> $@; \
 $(ECHO) "WARN_IF_UNDOCUMENTED   = YES"                                                 >> $@; \
 $(ECHO) "WARN_IF_DOC_ERROR      = YES"                                                 >> $@; \
 $(ECHO) "WARN_NO_PARAMDOC       = YES"                                                 >> $@; \
 $(ECHO) "WARN_FORMAT            = \"\$$file:\$$line: \$$text\""                        >> $@; \
 $(ECHO) "WARN_LOGFILE           = $(ERR_PATH)\doxygen.err"                             >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to the input files"                           >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "INPUT                  = $(DOXYGEN_INPUT)"                                    >> $@; \
 $(ECHO) "INPUT_ENCODING         = UTF-8"                                               >> $@; \
 $(ECHO) "FILE_PATTERNS          = *.h \\"                                              >> $@; \
 $(ECHO) "                         *.c"                                                 >> $@; \
 $(ECHO) "RECURSIVE              = NO"                                                  >> $@; \
 $(ECHO) "EXCLUDE                = "                                                    >> $@; \
 $(ECHO) "EXCLUDE_SYMLINKS       = NO"                                                  >> $@; \
 $(ECHO) "EXCLUDE_PATTERNS       = "                                                    >> $@; \
 $(ECHO) "EXCLUDE_SYMBOLS        = "                                                    >> $@; \
 $(ECHO) "EXAMPLE_PATH           = "                                                    >> $@; \
 $(ECHO) "EXAMPLE_PATTERNS       = "                                                    >> $@; \
 $(ECHO) "EXAMPLE_RECURSIVE      = NO"                                                  >> $@; \
 $(ECHO) "IMAGE_PATH             = $(CMD_PATH)/doxygen/images"                          >> $@; \
 $(ECHO) "INPUT_FILTER           = "                                                    >> $@; \
 $(ECHO) "FILTER_PATTERNS        = "                                                    >> $@; \
 $(ECHO) "FILTER_SOURCE_FILES    = NO"                                                  >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to source browsing"                           >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "SOURCE_BROWSER         = YES"                                                 >> $@; \
 $(ECHO) "INLINE_SOURCES         = YES"                                                 >> $@; \
 $(ECHO) "STRIP_CODE_COMMENTS    = YES"                                                 >> $@; \
 $(ECHO) "REFERENCED_BY_RELATION = YES"                                                 >> $@; \
 $(ECHO) "REFERENCES_RELATION    = YES"                                                 >> $@; \
 $(ECHO) "REFERENCES_LINK_SOURCE = YES"                                                 >> $@; \
 $(ECHO) "USE_HTAGS              = NO"                                                  >> $@; \
 $(ECHO) "VERBATIM_HEADERS       = YES"                                                 >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to the alphabetical class index"              >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "ALPHABETICAL_INDEX     = YES"                                                 >> $@; \
 $(ECHO) "COLS_IN_ALPHA_INDEX    = 5"                                                   >> $@; \
 $(ECHO) "IGNORE_PREFIX          = "                                                    >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to the HTML output"                           >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "GENERATE_HTML          = YES"                                                 >> $@; \
 $(ECHO) "HTML_OUTPUT            = docs\html"                                           >> $@; \
 $(ECHO) "HTML_FILE_EXTENSION    = .html"                                               >> $@; \
 $(ECHO) "HTML_HEADER            = $(CMD_PATH)/doxygen/header.txt"                      >> $@; \
 $(ECHO) "HTML_FOOTER            = $(CMD_PATH)/doxygen/footer.txt"                      >> $@; \
 $(ECHO) "HTML_STYLESHEET        = $(CMD_PATH)/doxygen/vector.css"                      >> $@; \
 $(ECHO) "HTML_ALIGN_MEMBERS     = YES"                                                 >> $@; \
 $(ECHO) "GENERATE_HTMLHELP      = YES"                                                 >> $@; \
 $(ECHO) "GENERATE_DOCSET        = NO"                                                  >> $@; \
 $(ECHO) "DOCSET_FEEDNAME        = Doxygen generated docs"                              >> $@; \
 $(ECHO) "DOCSET_BUNDLE_ID       = org.doxygen.Project"                                 >> $@; \
 $(ECHO) "HTML_DYNAMIC_SECTIONS  = NO"                                                  >> $@; \
 $(ECHO) "CHM_FILE               = .\$(PROJECT_NAME).chm"                               >> $@; \
 $(ECHO) "HHC_LOCATION           = \"C:/Programme/HTML Help Workshop/hhc.exe\""         >> $@; \
 $(ECHO) "GENERATE_CHI           = NO"                                                  >> $@; \
 $(ECHO) "BINARY_TOC             = NO"                                                  >> $@; \
 $(ECHO) "TOC_EXPAND             = NO"                                                  >> $@; \
 $(ECHO) "DISABLE_INDEX          = NO"                                                  >> $@; \
 $(ECHO) "ENUM_VALUES_PER_LINE   = 1"                                                   >> $@; \
 $(ECHO) "GENERATE_TREEVIEW      = YES"                                                 >> $@; \
 $(ECHO) "TREEVIEW_WIDTH         = 250"                                                 >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to the LaTeX output"                          >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "GENERATE_LATEX         = NO"                                                  >> $@; \
 $(ECHO) "LATEX_OUTPUT           = docs\latex"                                          >> $@; \
 $(ECHO) "LATEX_CMD_NAME         = latex"                                               >> $@; \
 $(ECHO) "MAKEINDEX_CMD_NAME     = makeindex"                                           >> $@; \
 $(ECHO) "COMPACT_LATEX          = NO"                                                  >> $@; \
 $(ECHO) "PAPER_TYPE             = a4wide"                                              >> $@; \
 $(ECHO) "EXTRA_PACKAGES         = "                                                    >> $@; \
 $(ECHO) "LATEX_HEADER           = "                                                    >> $@; \
 $(ECHO) "PDF_HYPERLINKS         = NO"                                                  >> $@; \
 $(ECHO) "USE_PDFLATEX           = NO"                                                  >> $@; \
 $(ECHO) "LATEX_BATCHMODE        = NO"                                                  >> $@; \
 $(ECHO) "LATEX_HIDE_INDICES     = NO"                                                  >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to the RTF output"                            >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "GENERATE_RTF           = NO"                                                  >> $@; \
 $(ECHO) "RTF_OUTPUT             = docs\rtf"                                            >> $@; \
 $(ECHO) "COMPACT_RTF            = NO"                                                  >> $@; \
 $(ECHO) "RTF_HYPERLINKS         = YES"                                                 >> $@; \
 $(ECHO) "RTF_STYLESHEET_FILE    = "                                                    >> $@; \
 $(ECHO) "RTF_EXTENSIONS_FILE    = "                                                    >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to the man page output"                       >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "GENERATE_MAN           = NO"                                                  >> $@; \
 $(ECHO) "MAN_OUTPUT             = docs\man"                                            >> $@; \
 $(ECHO) "MAN_EXTENSION          = .3"                                                  >> $@; \
 $(ECHO) "MAN_LINKS              = NO"                                                  >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to the XML output"                            >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "GENERATE_XML           = NO"                                                  >> $@; \
 $(ECHO) "XML_OUTPUT             = docs\xml"                                            >> $@; \
 $(ECHO) "XML_SCHEMA             = "                                                    >> $@; \
 $(ECHO) "XML_DTD                = "                                                    >> $@; \
 $(ECHO) "XML_PROGRAMLISTING     = YES"                                                 >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options for the AutoGen Definitions output"                   >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "GENERATE_AUTOGEN_DEF   = NO"                                                  >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# configuration options related to the Perl module output"                    >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "GENERATE_PERLMOD       = NO"                                                  >> $@; \
 $(ECHO) "PERLMOD_LATEX          = NO"                                                  >> $@; \
 $(ECHO) "PERLMOD_PRETTY         = YES"                                                 >> $@; \
 $(ECHO) "PERLMOD_MAKEVAR_PREFIX = "                                                    >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# Configuration options related to the preprocessor   "                       >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "ENABLE_PREPROCESSING   = YES"                                                 >> $@; \
 $(ECHO) "MACRO_EXPANSION        = YES"                                                 >> $@; \
 $(ECHO) "EXPAND_ONLY_PREDEF     = NO"                                                  >> $@; \
 $(ECHO) "SEARCH_INCLUDES        = YES"                                                 >> $@; \
 $(ECHO) "INCLUDE_PATH           = $(DOXYGEN_INCLUDE)"                                  >> $@; \
 $(ECHO) "INCLUDE_FILE_PATTERNS  = *.h"                                                 >> $@; \
 $(ECHO) "PREDEFINED             = $(PCLINT_DEF)"                                       >> $@; \
 $(ECHO) "EXPAND_AS_DEFINED      = "                                                    >> $@; \
 $(ECHO) "SKIP_FUNCTION_MACROS   = NO"                                                  >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# Configuration::additions related to external references   "                  >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "TAGFILES               = "                                                    >> $@; \
 $(ECHO) "GENERATE_TAGFILE       = "                                                    >> $@; \
 $(ECHO) "ALLEXTERNALS           = NO"                                                  >> $@; \
 $(ECHO) "EXTERNAL_GROUPS        = YES"                                                 >> $@; \
 $(ECHO) "PERL_PATH              = "                                                    >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# Configuration options related to the dot tool   "                           >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "CLASS_DIAGRAMS         = YES"                                                 >> $@; \
 $(ECHO) "MSCGEN_PATH            = $(subst /,\\,$(CMD_PATH)/doxygen/mscgen)"            >> $@; \
 $(ECHO) "HIDE_UNDOC_RELATIONS   = YES"                                                 >> $@; \
 $(ECHO) "HAVE_DOT               = YES"                                                 >> $@; \
 $(ECHO) "CLASS_GRAPH            = YES"                                                 >> $@; \
 $(ECHO) "COLLABORATION_GRAPH    = YES"                                                 >> $@; \
 $(ECHO) "GROUP_GRAPHS           = YES"                                                 >> $@; \
 $(ECHO) "UML_LOOK               = YES"                                                 >> $@; \
 $(ECHO) "TEMPLATE_RELATIONS     = YES"                                                 >> $@; \
 $(ECHO) "INCLUDE_GRAPH          = YES"                                                 >> $@; \
 $(ECHO) "INCLUDED_BY_GRAPH      = YES"                                                 >> $@; \
 $(ECHO) "CALL_GRAPH             = YES"                                                 >> $@; \
 $(ECHO) "CALLER_GRAPH           = YES"                                                 >> $@; \
 $(ECHO) "GRAPHICAL_HIERARCHY    = YES"                                                 >> $@; \
 $(ECHO) "DIRECTORY_GRAPH        = YES"                                                 >> $@; \
 $(ECHO) "DOT_IMAGE_FORMAT       = png"                                                 >> $@; \
 $(ECHO) "DOT_PATH               = $(subst /,\\,$(CMD_PATH)/doxygen)"                   >> $@; \
 $(ECHO) "DOTFILE_DIRS           = "                                                    >> $@; \
 $(ECHO) "DOT_GRAPH_MAX_NODES    = 50"                                                  >> $@; \
 $(ECHO) "MAX_DOT_GRAPH_DEPTH    = 1000"                                                >> $@; \
 $(ECHO) "DOT_TRANSPARENT        = YES"                                                 >> $@; \
 $(ECHO) "DOT_MULTI_TARGETS      = NO"                                                  >> $@; \
 $(ECHO) "GENERATE_LEGEND        = YES"                                                 >> $@; \
 $(ECHO) "DOT_CLEANUP            = YES"                                                 >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "# Configuration::additions related to the search engine   "                   >> $@; \
 $(ECHO) "#---------------------------------------------------------------------------" >> $@; \
 $(ECHO) "SEARCHENGINE           = NO"                                                  >> $@; \
 $(ECHO) "...done";                                                                            \
 $(ECHO) "";
endif

##############################################################################
# Resource information generation
##############################################################################
#-----------------------------------------------------------------------------
# List of files, which contain the resource information
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
LST_LIST = \
    $(if $(findstring $(RESOURCE_FILE),LIST), $(LST_PATH)/*.$(RESOURCE_FILE_EXT), \
        $(if $(findstring $(RESOURCE_FILE),MAP),                                  \
            $(PROJECT_NAME).$(RESOURCE_FILE_EXT)                                  \
        ,                                                                         \
            RESOURCE_NOT_SET                                                      \
        )                                                                         \
    )
endif
#-----------------------------------------------------------------------------
# General storage location for resource information
#-----------------------------------------------------------------------------
RESOURCE_REPOSITORY  = \\vistrfs1\vgroup\PES\30_ProductManagement\_EmbeddedSwRessourceNeeds

#-----------------------------------------------------------------------------
# Resource information generation rules
#-----------------------------------------------------------------------------
ifeq ($(QUICKBUILD),)
RESOURCE_NOT_SET:
	@$(ECHO) "Resource is not set correctly or resource target not supported for selected platform.";

fetch-memory-info-meta.txt:
	@$(ECHO) "COMPILER_MANUFACTURER:"   '$(subst \,\\, $(COMPILER_MANUFACTURER))'> $@;  \
 $(ECHO) "PROJECT_DIR:"             '$(subst \,\\, $(subst \\,\,$(CURDIR)))'        >> $@;  \
 $(ECHO) "PLATFORM:"                '$(subst \,\\, $(PLATFORM))'                    >> $@;  \
 $(ECHO) "EMULATOR:"                '$(subst \,\\, $(EMULATOR))'                    >> $@;  \
 $(ECHO) "EVA_BOARD:"               '$(subst \,\\, $(EVA_BOARD))'                   >> $@;  \
 $(ECHO) "DERIVATIVE:"              '$(subst \,\\, $(DERIVATIVE))'                  >> $@;  \
 $(ECHO) "PROJECT_NAME:"            '$(subst \,\\, $(PROJECT_NAME))'                >> $@;  \
 $(ECHO) "CFLAGS_OPTIMIZATION:"     '$(subst \,\\, $(CFLAGS_OPTIMIZATION))'         >> $@;  \
 $(ECHO) "CFLAGS_MEMORYMODEL:"      '$(subst \,\\, $(CFLAGS_MEMORYMODEL))'          >> $@;  \
 $(ECHO) "CC_VERSION_STRING:"       '$(subst \,\\, $(CC_VERSION_STRING))'           >> $@;  \
 $(ECHO) "CFLAGS_ADDITIONAL_PRE:"   '$(subst \,\\, $(CFLAGS_ADDITIONAL_PRE))'       >> $@;  \
 $(ECHO) "CFLAGS_WARNING:"          '$(subst \,\\, $(CFLAGS_WARNING))'              >> $@;  \
 $(ECHO) "CFLAGS_OPTIMIZATION:"     '$(subst \,\\, $(CFLAGS_OPTIMIZATION))'         >> $@;  \
 $(ECHO) "CFLAGS_MEMORYMODEL:"      '$(subst \,\\, $(CFLAGS_MEMORYMODEL))'          >> $@;  \
 $(ECHO) "CFLAGS_ADDITIONAL_POST:"  '$(subst \,\\, $(CFLAGS_ADDITIONAL_POST))'      >> $@;  \
 $(ECHO) "CVERSION_STRING:"         '$(subst \,\\, $(CVERSION_STRING))'             >> $@;  \
 $(ECHO) "LDFLAGS_ADDITIONAL_PRE:"  '$(subst \,\\, $(LDFLAGS_ADDITIONAL_PRE))'      >> $@;  \
 $(ECHO) "LDFLAGS_WARNING:"         '$(subst \,\\, $(LDFLAGS_WARNING))'             >> $@;  \
 $(ECHO) "LDFLAGS_OPTIMIZATION:"    '$(subst \,\\, $(LDFLAGS_OPTIMIZATION))'        >> $@;  \
 $(ECHO) "LDFLAGS_MEMORYMODEL:"     '$(subst \,\\, $(LDFLAGS_MEMORYMODEL))'         >> $@;  \
 $(ECHO) "LDFLAGS_ADDITIONAL_POST:" '$(subst \,\\, $(LDFLAGS_ADDITIONAL_POST))'     >> $@;  \
 $(ECHO) "LDVERSION_STRING:"        '$(subst \,\\, $(LDVERSION_STRING))'            >> $@;  \
 $(ECHO) "ASFLAGS_ADDITIONAL_PRE:"  '$(subst \,\\, $(ASFLAGS_ADDITIONAL_PRE))'      >> $@;  \
 $(ECHO) "ASFLAGS_WARNING:"         '$(subst \,\\, $(ASFLAGS_WARNING))'             >> $@;  \
 $(ECHO) "ASFLAGS_OPTIMIZATION:"    '$(subst \,\\, $(ASFLAGS_OPTIMIZATION))'        >> $@;  \
 $(ECHO) "ASFLAGS_MEMORYMODEL:"     '$(subst \,\\, $(ASFLAGS_MEMORYMODEL))'         >> $@;  \
 $(ECHO) "ASFLAGS_ADDITIONAL_POST:" '$(subst \,\\, $(ASFLAGS_ADDITIONAL_POST))'     >> $@;  \
 $(ECHO) "ASVERSION_STRING:"        '$(subst \,\\, $(ASVERSION_STRING))'            >> $@;  \
 $(ECHO) "MAFLAGS_ADDITIONAL_PRE:"  '$(subst \,\\, $(MAFLAGS_ADDITIONAL_PRE))'      >> $@;  \
 $(ECHO) "MAFLAGS_WARNING:"         '$(subst \,\\, $(MAFLAGS_WARNING))'             >> $@;  \
 $(ECHO) "MAFLAGS_OPTIMIZATION:"    '$(subst \,\\, $(MAFLAGS_OPTIMIZATION))'        >> $@;  \
 $(ECHO) "MAFLAGS_MEMORYMODEL:"     '$(subst \,\\, $(MAFLAGS_MEMORYMODEL))'         >> $@;  \
 $(ECHO) "MAFLAGS_ADDITIONAL_POST:" '$(subst \,\\, $(MAFLAGS_ADDITIONAL_POST))'     >> $@;  \
 $(ECHO) "MAVERSION_STRING:"        '$(subst \,\\, $(MAVERSION_STRING))'            >> $@;  \
 $(ECHO) "EXT_T1_VERSION_STRING:"   '$(subst \,\\, $(EXT_T1_VERSION_STRING))'       >> $@;  \
 $(ECHO) "EXT_T1_FLAGS:"            '$(subst \,\\, $(EXT_T1_FLAGS))'                >> $@;  \
 $(ECHO) "EXT_T2_VERSION_STRING:"   '$(subst \,\\, $(EXT_T2_VERSION_STRING))'       >> $@;  \
 $(ECHO) "EXT_T2_FLAGS:"            '$(subst \,\\, $(EXT_T2_FLAGS))'                >> $@;  \
 if [ -n "$(FROM_VINFO_CBD)" ] ; then                                                       \
 $(ECHO) "FROM_VINFO_CBD:"          '$(subst \,\\, $(FROM_VINFO_CBD))'              >> $@;  \
 fi;                                                                                        \
 if [ -n "$(FROM_VINFO_SIP)" ] ; then                                                       \
 $(ECHO) "FROM_VINFO_SIP:"          '$(subst \,\\, $(FROM_VINFO_SIP))'              >> $@;  \
 fi;                                                                                        \
 if [ -n "$(FROM_VINFO_OEM)" ] ; then                                                       \
 $(ECHO) "FROM_VINFO_OEM:"          '$(subst \,\\, $(FROM_VINFO_OEM))'              >> $@;  \
 fi;                                                                                        \
 if [ -n "$(FROM_VINFO_CONTROLLER)" ] ; then                                                \
 $(ECHO) "FROM_VINFO_CONTROLLER:"   '$(subst \,\\, $(FROM_VINFO_CONTROLLER))'       >> $@;  \
 fi;                                                                                        \
 if [ -n "$(FROM_VINFO_COMPILER)" ] ; then                                                  \
 $(ECHO) "FROM_VINFO_COMPILER:"     '$(subst \,\\, $(FROM_VINFO_COMPILER))'         >> $@;  \
 fi;                                                                                        \
 if [ -n "$(FROM_VINFO_SLP)" ] ; then                                                       \
 $(ECHO) "FROM_VINFO_SLP:"          '$(subst \,\\, $(FROM_VINFO_SLP))'              >> $@;  \
 fi;                                                                                        \
 if [ -n "$(FROM_VINFO_CANCELL)" ] ; then                                                   \
 $(ECHO) "FROM_VINFO_CANCELL:"      '$(subst \,\\, $(FROM_VINFO_CANCELL))'          >> $@;  \
 fi;

fetch-memory-info.awk: force
	@$(ECHO) '$(RESOURCE_FETCH_SCRIPT)'                                                                             > $@; \
 $(ECHO) "BEGIN {"                                                                                                     >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# Print the header of the outputted file"                                                                    >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "_additional_module_lst = \"$(subst \,\\\\,$(ADDITIONAL_OBJECTS)) $(subst \,\\\\,$(ZBRS_DATA)) $(subst \,\\\\,$(ZBRS_COMMON)) $(subst \,\\\\,$(APP_SOURCE_LST))\";" >> $@; \
 $(ECHO) "  if (XML) {"                                                                                                >> $@; \
 $(ECHO) "    print \"<?xml version='1.0'?>\";"                                                                        >> $@; \
 $(ECHO) "    print \"<memory-usage>\"; # root tag"                                                                    >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  while (getline < \"fetch-memory-info-meta.txt\")"                                                          >> $@; \
 $(ECHO) "  {"                                                                                                         >> $@; \
 $(ECHO) "    _colon_index = index(\$$0, \":\");"                                                                      >> $@; \
 $(ECHO) "    if (_colon_index <= 0) {"                                                                                >> $@; \
 $(ECHO) "      continue;"                                                                                             >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "    _key = substr(\$$0, 0, _colon_index - 1);"                                                               >> $@; \
 $(ECHO) "    _val = substr(\$$0, _colon_index + 1);"                                                                  >> $@; \
 $(ECHO) "    _val = trim(_val);"                                                                                      >> $@; \
 $(ECHO) "    if (_val ~ /^[-=]/) {"                                                                                   >> $@; \
 $(ECHO) "      _val = \"'\" _val;"                                                                                    >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "    if (XML) { # translate some entities"                                                                    >> $@; \
 $(ECHO) "      gsub(\">\", \"\\\\&gt;\", _val);"                                                                      >> $@; \
 $(ECHO) "      gsub(\"<\", \"\\\\&lt;\", _val);"                                                                      >> $@; \
 $(ECHO) "      gsub(\"&\", \"\\\\&amp;\", _val);"                                                                     >> $@; \
 $(ECHO) "      gsub(\"\\\"\", \"\\\\&quot;\", _val);"                                                                 >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "    if (XML) {"                                                                                              >> $@; \
 $(ECHO) "      printf \"  <meta name=\\\"%s\\\">%s</meta>\\n\", _key, _val;"                                          >> $@; \
 $(ECHO) "    } else {"                                                                                                >> $@; \
 $(ECHO) "      printf \"%s\\t%s\\n\", _key, _val;"                                                                    >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "    if (_key == \"PROJECT_DIR\") {"                                                                          >> $@; \
 $(ECHO) "      match(_val, /^[C-Z]:\\\\usr\\\\distrib\\\\[^\\\\]+\\\\[^\\\\]+\\\\([^\\\\]+)\\\\([^\\\\]+)\\\\/,"      >> $@; \
 $(ECHO) "            _OEM_SLP);"                                                                                      >> $@; \
 $(ECHO) "      if (XML) {"                                                                                            >> $@; \
 $(ECHO) "        printf \"  <meta name=\\\"OEM\\\">%s</meta>\\n\", _OEM_SLP[1];"                                      >> $@; \
 $(ECHO) "        printf \"  <meta name=\\\"SLP\\\">%s</meta>\\n\", _OEM_SLP[2];"                                      >> $@; \
 $(ECHO) "      } else {"                                                                                              >> $@; \
 $(ECHO) "        printf \"OEM\\t%s\\n\", _OEM_SLP[1];"                                                                >> $@; \
 $(ECHO) "        printf \"SLP\\t%s\\n\", _OEM_SLP[2];"                                                                >> $@; \
 $(ECHO) "      }"                                                                                                     >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  printf \"\\n\";"                                                                                           >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# This section is called at the end of the whole script."                                                    >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "END {"                                                                                                       >> $@; \
 $(ECHO) "    if (DEBUG) {"                                                                                            >> $@; \
 $(ECHO) "        printf \"\\n\\n\"; # two empty lines"                                                                >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  if (!XML) {"                                                                                               >> $@; \
 $(ECHO) "    print \"Module\\tcode\\tconst\\tRAM\\tInitRAM\";"                                                        >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  printEntries();"                                                                                           >> $@; \
 $(ECHO) "  if (XML) {"                                                                                                >> $@; \
 $(ECHO) "    print \"</memory-usage>\"; # root tag"                                                                   >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# This API function is the most important one:"                                                              >> $@; \
 $(ECHO) "# It adds an entry to the internal list, which is printed at the end."                                       >> $@; \
 $(ECHO) "# @param string moduleName: Contains the name of the module you want to add"                                 >> $@; \
 $(ECHO) "#           byteSize."                                                                                       >> $@; \
 $(ECHO) "# @param string memoryType: Contains the memory type you want to add byteSize."                              >> $@; \
 $(ECHO) "#           The memory type is mapped by the memoryTable to the according"                                   >> $@; \
 $(ECHO) "#           memory section (ram, rom, const)."                                                               >> $@; \
 $(ECHO) "# @param string byteSize: Contains the size of memory in bytes. The format must"                             >> $@; \
 $(ECHO) "#           be either hexadecimal or decimal. Number with a leading '0x' or a"                               >> $@; \
 $(ECHO) "#           trailing 'h' are autodetected as a hexadecimal value."                                           >> $@; \
 $(ECHO) "# @param bool isHex: OPTIONAL: If set to 1 the param byteSize will be treated as"                            >> $@; \
 $(ECHO) "#           a hexadecimal string. If 0 (standard) the function tries to auto-"                               >> $@; \
 $(ECHO) "#           detect if byteSize is a hex or a decimal value."                                                 >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function addEntry(moduleName, memoryType, byteSize, isHex) {"                                                >> $@; \
 $(ECHO) "  moduleName = trim(moduleName);"                                                                            >> $@; \
 $(ECHO) "  memoryType = trim(memoryType);"                                                                            >> $@; \
 $(ECHO) "  byteSize   = trim(byteSize);"                                                                              >> $@; \
 $(ECHO) "  # If byteSize has a trailing 'h' or a leading '0x' hexformat is autodetected"                              >> $@; \
 $(ECHO) "  if (isHex || (byteSize ~ /^0x/) || (byteSize ~ /h\$$/)) {"                                                 >> $@; \
 $(ECHO) "    byteSize = hex2dec(byteSize);"                                                                           >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  "                                                                                                          >> $@; \
 $(ECHO) "  mappedMemoryType  = parseMemoryType(memoryType);"                                                          >> $@; \
 $(ECHO) "  moduleName        = pathToModule(moduleName);"                                                             >> $@; \
 $(ECHO) "  "                                                                                                          >> $@; \
 $(ECHO) "  if (DEBUG) {"                                                                                              >> $@; \
 $(ECHO) "    printf \"%5d Adding: %12s %14s -> %6s 0x%04X (%d)\\n\", FNR, moduleName, \\"                             >> $@; \
 $(ECHO) "                      memoryType, mappedMemoryType, byteSize, byteSize;"                                     >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  if (mappedMemoryType == \"ignore\") {"                                                                     >> $@; \
 $(ECHO) "    return;"                                                                                                 >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  _private_array_modules[moduleName, mappedMemoryType] += byteSize;"                                         >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# The function decides, depending on the current file and the processing state"                              >> $@; \
 $(ECHO) "# (set by startProcessing() and stopProcessing()), if processing has to"                                     >> $@; \
 $(ECHO) "# continue or jump to next record."                                                                          >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function process() {"                                                                                        >> $@; \
 $(ECHO) "  if (FNR == 1 && DEBUG) {"                                                                                  >> $@; \
 $(ECHO) "    print  \"\"; # print empty line"                                                                         >> $@; \
 $(ECHO) "    printf \"!Begin with File \\\"%s\\\"\\n\", FILENAME;"                                                    >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  if (_private_processingState != FILENAME) { # inactive"                                                    >> $@; \
 $(ECHO) "    next;"                                                                                                   >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# This function starts the processing for the current file. After calling"                                   >> $@; \
 $(ECHO) "# the processing will begin and no further records are skipped."                                             >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function startProcessing() {"                                                                                >> $@; \
 $(ECHO) "  if ((_private_processingState != FILENAME) && DEBUG) {"                                                    >> $@; \
 $(ECHO) "    printf \"!Start processing file \\\"%s\\\" at line %d\\n\", FILENAME, FNR;"                              >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  _private_processingState = FILENAME;"                                                                      >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# This function is the complement to startProcessing() and stops the processing."                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function stopProcessing() {"                                                                                 >> $@; \
 $(ECHO) "  if (_private_processingState == FILENAME) { # We started processing"                                       >> $@; \
 $(ECHO) "    if (DEBUG) {"                                                                                            >> $@; \
 $(ECHO) "      printf \"!Stopping processing file \\\"%s\\\" at line %d\\n\", FILENAME, FNR;"                         >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "    _private_processingState = 0;"                                                                           >> $@; \
 $(ECHO) "    nextfile; # We're done for this file. Go to the next one"                                                >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# This function converts a hexadecimal number to a decimal one."                                             >> $@; \
 $(ECHO) "# @param string hexStr: The string which has to be converted. Dont need to have"                             >> $@; \
 $(ECHO) "#             leading '0x'. Can have a trailing 'h'."                                                        >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function hex2dec(hexStr) {"                                                                                  >> $@; \
 $(ECHO) "  if (hexStr !~ /^0x/) {"                                                                                    >> $@; \
 $(ECHO) "    hexStr = \"0x\" hexStr;"                                                                                 >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  if (hexStr ~ /h\$$/) {"                                                                                    >> $@; \
 $(ECHO) "    gsub(/h\$$/, \"\", hexStr); # Strip trailing 'h'"                                                        >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  return strtonum(hexStr);"                                                                                  >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# This function prints the internal array which contains the memory information"                             >> $@; \
 $(ECHO) "# The output format is a tab seperated list with the order:"                                                 >> $@; \
 $(ECHO) "# moduleName, sizeCode, sizeConst, sizeRam"                                                                  >> $@; \
 $(ECHO) "# @param NONE!"                                                                                              >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function printEntries(j, i, n, ind, keyArr, key, moduleName, printedModules,"                                >> $@; \
 $(ECHO) "                      ram, code, const, iram, totaliram)"                                                    >> $@; \
 $(ECHO) "{"                                                                                                           >> $@; \
 $(ECHO) "  if (XML) {"                                                                                                >> $@; \
 $(ECHO) "    print \"  <modules>\";"                                                                                  >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  j = 1;"                                                                                                    >> $@; \
 $(ECHO) "  for (i in _private_array_modules) {"                                                                       >> $@; \
 $(ECHO) "    ind[j] = i; # index value becomes element value"                                                         >> $@; \
 $(ECHO) "    j++;"                                                                                                    >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  if( j == 1 ) {"                                                                                            >> $@; \
 $(ECHO) "    error(\"Your AWK Script never called addEntry(). Please check Makefile Script.\");"                      >> $@; \
 $(ECHO) "    n = 0;"                                                                                                  >> $@; \
 $(ECHO) "  } else {"                                                                                                  >> $@; \
 $(ECHO) "    n = asort(ind); # index values are now sorted"                                                           >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  gsub(/\\\\ /, \"~~~\", _additional_module_lst);"                                                           >> $@; \
 $(ECHO) "  _number_additional_modulese = split(_additional_module_lst, _tmp, \"[ ]+\");"                              >> $@; \
 $(ECHO) "  for( i = 1; i <= _number_additional_modulese; i++ ) {"                                                     >> $@; \
 $(ECHO) "    gsub(/~~~/, \" \", _tmp[i]);"                                                                            >> $@; \
 $(ECHO) "    _additional_module_array[pathToModule(_tmp[i])] = 1;"                                                    >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  for (i = 1; i <= n; i++) {"                                                                                >> $@; \
 $(ECHO) "    key = ind[i];"                                                                                           >> $@; \
 $(ECHO) "    split(key, keyArr, SUBSEP);"                                                                             >> $@; \
 $(ECHO) "    moduleName = keyArr[1];"                                                                                 >> $@; \
 $(ECHO) "    if( moduleName in _additional_module_array ) {"                                                          >> $@; \
 $(ECHO) "      _private_array_modules[moduleName, \"__ISADD__\"] = 1;"                                                >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  print \"\";"                                                                                               >> $@; \
 $(ECHO) "  printModuleSummary(ind, n, 0);"                                                                            >> $@; \
 $(ECHO) "  print \"\"; print \"\";"                                                                                   >> $@; \
 $(ECHO) "  printModuleSummary(ind, n, 1);"                                                                            >> $@; \
 $(ECHO) "  if (XML) {"                                                                                                >> $@; \
 $(ECHO) "    print \"  </modules>\";"                                                                                 >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) "function printModuleSummary(ind, n, isAdditional) {"                                                         >> $@; \
 $(ECHO) "  if( isAdditional ) {"                                                                                      >> $@; \
 $(ECHO) "    if( XML ) {"                                                                                             >> $@; \
 $(ECHO) "      print \"<additional>\";"                                                                               >> $@; \
 $(ECHO) "    } else {"                                                                                                >> $@; \
 $(ECHO) "      print \"Additonal modules:\";"                                                                         >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  } else {"                                                                                                  >> $@; \
 $(ECHO) "    if( XML ) {"                                                                                             >> $@; \
 $(ECHO) "      print \"<core>\";"                                                                                     >> $@; \
 $(ECHO) "    } else {"                                                                                                >> $@; \
 $(ECHO) "      print \"Core modules:\";"                                                                              >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  totaliram = 0;"                                                                                            >> $@; \
 $(ECHO) "  totalram = 0;"                                                                                             >> $@; \
 $(ECHO) "  totalrom = 0;"                                                                                             >> $@; \
 $(ECHO) "  totalcode = 0;"                                                                                            >> $@; \
 $(ECHO) "  for (i = 1; i <= n; i++) {"                                                                                >> $@; \
 $(ECHO) "    key = ind[i];"                                                                                           >> $@; \
 $(ECHO) "    split(key, keyArr, SUBSEP);"                                                                             >> $@; \
 $(ECHO) "    moduleName = keyArr[1];"                                                                                 >> $@; \
 $(ECHO) "    if( isAdditional != _private_array_modules[moduleName, \"__ISADD__\"] ) {"                               >> $@; \
 $(ECHO) "      continue;"                                                                                             >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "    if ( !(moduleName in printedModules) ) {"                                                                >> $@; \
 $(ECHO) "      ram = _private_array_modules[moduleName, \"ram\"]+0;"                                                  >> $@; \
 $(ECHO) "      iram = _private_array_modules[moduleName, \"iram\"]+0;"                                                >> $@; \
 $(ECHO) "      code = _private_array_modules[moduleName, \"code\"]+0;"                                                >> $@; \
 $(ECHO) "      const = _private_array_modules[moduleName, \"const\"]+0;"                                              >> $@; \
 $(ECHO) "      totaliram += iram;"                                                                                    >> $@; \
 $(ECHO) "      totalcode += code;"                                                                                    >> $@; \
 $(ECHO) "      totalram  += ram;"                                                                                     >> $@; \
 $(ECHO) "      totalrom  += const;"                                                                                   >> $@; \
 $(ECHO) "      printedModules[moduleName] = 1;"                                                                       >> $@; \
 $(ECHO) "      if (XML)"                                                                                              >> $@; \
 $(ECHO) "      {"                                                                                                     >> $@; \
 $(ECHO) "        print \"    <module name=\\\"\" moduleName \"\\\">\";"                                               >> $@; \
 $(ECHO) "        print \"      <code>\" code \"</code>\";"                                                            >> $@; \
 $(ECHO) "        print \"      <const>\" const \"</const>\";"                                                         >> $@; \
 $(ECHO) "        print \"      <ram>\" ram \"</ram>\";"                                                               >> $@; \
 $(ECHO) "        print \"      <iram>\" iram \"</iram>\";"                                                            >> $@; \
 $(ECHO) "        print \"    </module>\";"                                                                            >> $@; \
 $(ECHO) "      }"                                                                                                     >> $@; \
 $(ECHO) "      else"                                                                                                  >> $@; \
 $(ECHO) "      {"                                                                                                     >> $@; \
 $(ECHO) "        print moduleName \"\\t\" code \"\\t\" const \"\\t\" ram \"\\t\" iram;"                               >> $@; \
 $(ECHO) "      }"                                                                                                     >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  if( !XML ) {"                                                                                              >> $@; \
 $(ECHO) "    print \"Total:\" \"\\t\" totalcode \"\\t\" totalrom \"\\t\" totalram \"\\t\" totaliram;"                 >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  if( totaliram > 0 ) {"                                                                                     >> $@; \
 $(ECHO) "    error(\"Warning: \" totaliram \" bytes initalized RAM is used!\");"                                      >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  if( isAdditional ) {"                                                                                      >> $@; \
 $(ECHO) "    if( XML ) {"                                                                                             >> $@; \
 $(ECHO) "      print \"</additional>\";"                                                                              >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  } else {"                                                                                                  >> $@; \
 $(ECHO) "    if( XML ) {"                                                                                             >> $@; \
 $(ECHO) "      print \"</core>\";"                                                                                    >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# Handles input strings like \"C:\\path\\to\\file.ext\" and filters out 'file'"                              >> $@; \
 $(ECHO) "# Strips out content within parentheses () and brackets [], but only if it"                                  >> $@; \
 $(ECHO) "# wouldnt result in a blank string."                                                                         >> $@; \
 $(ECHO) "# Hint: Bracket: []        Parentheses: ()"                                                                  >> $@; \
 $(ECHO) "# @param string pathname: Contains the path which is analysed"                                               >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function pathToModule(pathname) {"                                                                           >> $@; \
 $(ECHO) "  pathname = trim(pathname);"                                                                                >> $@; \
 $(ECHO) "  if (pathname ~ /^\\(+.*\\)+\$$/) { # only if pathname starts AND ends with ()"                             >> $@; \
 $(ECHO) "      sub(/^\\(+/, \"\", pathname); # Strip leading ("                                                       >> $@; \
 $(ECHO) "      sub(/\\)+\$$/, \"\", pathname); # Strip trailing )"                                                    >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  if (pathname ~ /^\\[+.*\\]+\$$/) { # only if pathname starts AND ends with []"                             >> $@; \
 $(ECHO) "      sub(/^\\[+/, \"\", pathname); # Strip leading ["                                                       >> $@; \
 $(ECHO) "      sub(/\\]+\$$/, \"\", pathname); # Strip trailing ]"                                                    >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  pathname = trim(pathname);"                                                                                >> $@; \
 $(ECHO) "  sub(/\\(.*\\)/,   \"\", pathname); # Strip contents within parentheses"                                    >> $@; \
 $(ECHO) "  sub(/\\[.*\\]/,   \"\", pathname); # Strip contents within brackets"                                       >> $@; \
 $(ECHO) "  sub(/.*[\\/\\\\]/, \"\", pathname); # Strip the path"                                                      >> $@; \
 $(ECHO) "  sub(/\\.[^.]+\$$/, \"\", pathname); # Strip file extension"                                                >> $@; \
 $(ECHO) "  return pathname;"                                                                                          >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# This function takes an string which is treated as a memory information and"                                >> $@; \
 $(ECHO) "# maps it to the according memory by the memoryTable array defined at the"                                   >> $@; \
 $(ECHO) "# BEGIN{} section. If no regular expression from the memoryTable matches, an"                                >> $@; \
 $(ECHO) "# error is printed and the program is shutting down."                                                        >> $@; \
 $(ECHO) "# @see memoryTable[] at BEGIN{} section"                                                                     >> $@; \
 $(ECHO) "# @param string input: The string which should be mapped."                                                   >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function parseMemoryType(input,     key, keyOrder, i, numberElements) {"                                     >> $@; \
 $(ECHO) "  numberElements = split(memoryTableOrder, keyOrder, \",\");"                                                >> $@; \
 $(ECHO) "  for (i = 1; i <= numberElements; i++) {"                                                                   >> $@; \
 $(ECHO) "    key = keyOrder[i];"                                                                                      >> $@; \
 $(ECHO) "    if(memoryTable[key] == \"\") {"                                                                          >> $@; \
 $(ECHO) "      continue;"                                                                                             >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "    if (input ~ memoryTable[key]) {"                                                                         >> $@; \
 $(ECHO) "      return key;"                                                                                           >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "  if( _private_detected_wrong_input[input] != 1 ) { # We did not yet print"                                  >> $@; \
 $(ECHO) "    _private_detected_wrong_input[input] = 1;"                                                               >> $@; \
 $(ECHO) "    if( _private_initial_print == 1 ) {"                                                                     >> $@; \
 $(ECHO) "      error(\"!Error: Other unknown input type: '\" input \"'\");"                                           >> $@; \
 $(ECHO) "    } else {"                                                                                                >> $@; \
 $(ECHO) "      error(\"--------------------------------------------------------------------\\n\" \\"                  >> $@; \
 $(ECHO) "            \"!Error: Unable to handle input type '\" input \"'\\n\" \\"                                     >> $@; \
 $(ECHO) "            \"  Filename: '\" FILENAME \"' at line \" FNR \"\\n\" \\"                                        >> $@; \
 $(ECHO) "            \"!Modify your AWK - Script in your project Makefile. The script is\\n\" \\"                     >> $@; \
 $(ECHO) "            \"   located at the Makefile variable \\\"RESOURCE_FETCH_SCRIPT\\\".\\n\" \\"                    >> $@; \
 $(ECHO) "            \"!Check your array <<memoryTable>> in the BEGIN{} section.\\n\" \\"                             >> $@; \
 $(ECHO) "            \"  E.g. add '\" input \"' to memoryTable[\\\"ram\\\"] to map it to RAM.\\n\" \\"                >> $@; \
 $(ECHO) "            \"  I.e.: memoryTable[\\\"ram\\\"] = \\\"\" memoryTable[\"ram\"] \"|\" input \"\\\";\\n\" \\"    >> $@; \
 $(ECHO) "            \"  To ignore '\" input \"', add it to memoryTable[\\\"ignore\\\"]:\\n\" \\"                     >> $@; \
 $(ECHO) "            \"  memoryTable[\\\"ignore\\\"] = \\\"\" memoryTable[\"ignore\"] \"|\" input \"\\\";\\n\" \\"    >> $@; \
 $(ECHO) "            \"--------------------------------------------------------------------\\n\");"                   >> $@; \
 $(ECHO) "    }"                                                                                                       >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  _private_initial_print = 1;"                                                                               >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# Small helper function to filter out a string enclosed in parentheses."                                     >> $@; \
 $(ECHO) "# @param string input: The input string which should be analysed"                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function getStringWithinParentheses(input,     tmpArr, tmpVar) {"                                            >> $@; \
 $(ECHO) "    if (match(input, /(\\(.+\\))/, tmpArr)) {"                                                               >> $@; \
 $(ECHO) "    tmpVar = tmpArr[1];"                                                                                     >> $@; \
 $(ECHO) "        gsub(/[\\(\\)]/, \"\", tmpVar); # strip off ( and )"                                                 >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  return (tmpVar ~ /\\w/) ? tmpVar : input;"                                                                 >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# Small helper function to filter out a string enclosed in brackets."                                        >> $@; \
 $(ECHO) "# @param string input: The input string which should be analysed"                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function getStringWithinBrackets(input,     tmpArr, tmpVar) {"                                               >> $@; \
 $(ECHO) "    if (match(input, /(\\[.+\\])/, tmpArr)) {"                                                               >> $@; \
 $(ECHO) "    tmpVar = tmpArr[1];"                                                                                     >> $@; \
 $(ECHO) "    gsub(/[\\[\\]]/, \"\", tmpVar); # strip off [ and ]"                                                     >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  return (tmpVar ~ /\\w/) ? tmpVar : input;"                                                                 >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# Small helper function to trim a string. Removes trailing and leading space/tab"                            >> $@; \
 $(ECHO) "# @param string input: The input string which has to be trimmed"                                             >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function trim(str) {"                                                                                        >> $@; \
 $(ECHO) "    gsub(/^[ \\t]+/, \"\", str); # Strip leading  space/tap (ltrim)"                                         >> $@; \
 $(ECHO) "    gsub(/[ \\t]+\$$/, \"\", str); # Strip trailing space/tab (rtrim)"                                       >> $@; \
 $(ECHO) "    return str;"                                                                                             >> $@; \
 $(ECHO) "}"                                                                                                           >> $@; \
 $(ECHO) ""                                                                                                            >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "# Small helper function to print an error."                                                                  >> $@; \
 $(ECHO) "# @param string input: The input string which has to printed."                                               >> $@; \
 $(ECHO) "################################################################################"                            >> $@; \
 $(ECHO) "function error(str) {"                                                                                       >> $@; \
 $(ECHO) "  if (XML) { # translate some entities"                                                                      >> $@; \
 $(ECHO) "    gsub(\">\", \"\\\\&gt;\", str);"                                                                         >> $@; \
 $(ECHO) "    gsub(\"<\", \"\\\\&lt;\", str);"                                                                         >> $@; \
 $(ECHO) "    gsub(\"&\", \"\\\\&amp;\", str);"                                                                        >> $@; \
 $(ECHO) "    gsub(\"\\\"\", \"\\\\&quot;\", str);"                                                                    >> $@; \
 $(ECHO) "    print \"<error>\";"                                                                                      >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "  print str;"                                                                                                >> $@; \
 $(ECHO) "  if (XML) {"                                                                                                >> $@; \
 $(ECHO) "    print \"</error>\";"                                                                                     >> $@; \
 $(ECHO) "  }"                                                                                                         >> $@; \
 $(ECHO) "}"                                                                                                           >> $@;

CLEAN_RESOURCE_FILENAME = $(subst $(_OPEN_PAREN),,$(subst $(_CLOSE_PAREN),,$(RESOURCE_FILENAME)))

resource: $(LST_LIST) $(if $(findstring $(LST_LIST),RESOURCE_NOT_SET),,fetch-memory-info-meta.txt fetch-memory-info.awk)
	@if [ "$(strip $(LST_LIST))" != "RESOURCE_NOT_SET" ] ; then                                                     \
    if [ -f $(GAWK) ] ; then                                                                                            \
      $(GAWK) --re-interval -v DEBUG=0 -f fetch-memory-info.awk $(LST_LIST)                                             \
          > $(LOG_PATH)/$(PROJECT_NAME)_resource.xls;                                                                   \
      $(GAWK) --re-interval -v   XML=1 -f fetch-memory-info.awk $(LST_LIST)                                             \
          > $(LOG_PATH)/$(PROJECT_NAME)_resource.xml;                                                                   \
      if [ -n "$(CLEAN_RESOURCE_FILENAME)" ] ; then                                                                     \
        $(ECHO) "Generated files: $(LOG_PATH)/$(CLEAN_RESOURCE_FILENAME).Resource.xml";                                 \
        $(ECHO) "                 $(LOG_PATH)/$(CLEAN_RESOURCE_FILENAME).Resource.xls";                                 \
        $(ECHO) "                 $(subst \,\\,$(RESOURCE_REPOSITORY)\$(RESOURCE_TARGETDIR)\$(CLEAN_RESOURCE_FILENAME)).Resource.xml";        \
        $(MV) $(LOG_PATH)/$(PROJECT_NAME)_resource.xls $(LOG_PATH)/$(CLEAN_RESOURCE_FILENAME).Resource.xls;             \
        $(MV) $(LOG_PATH)/$(PROJECT_NAME)_resource.xml $(LOG_PATH)/$(CLEAN_RESOURCE_FILENAME).Resource.xml;             \
        if [ -d $(subst \,/,$(RESOURCE_REPOSITORY)) ] ; then                                                            \
          if [ -d $(subst \,/,$(RESOURCE_REPOSITORY)\$(RESOURCE_TARGETDIR)) ] ; then :;                                 \
          else                                                                                                          \
          $(MKDIR) $(subst \,/,$(RESOURCE_REPOSITORY)\$(RESOURCE_TARGETDIR));                                           \
          fi;                                                                                                           \
          $(call _xcopy,$(LOG_PATH)/$(CLEAN_RESOURCE_FILENAME).Resource.xml,                                            \
                     $(RESOURCE_REPOSITORY)/$(RESOURCE_TARGETDIR))                                                      \
          $(CP) $(RESOURCE_COPYFILES) $(subst \,/,$(RESOURCE_REPOSITORY)\$(RESOURCE_TARGETDIR)) 2>/dev/null;            \
        else                                                                                                            \
          $(ECHO) "Error: Repository path not correct!";                                                                \
        fi;                                                                                                             \
      else                                                                                                              \
        $(ECHO) "Generated files: $(LOG_PATH)/$(PROJECT_NAME)_resource.xml";                                            \
        $(ECHO) "                 $(LOG_PATH)/$(PROJECT_NAME)_resource.xls";                                            \
      fi;                                                                                                               \
      if [ -n "$(GAWK_DEBUG)" ] ; then                                                                                  \
          $(ECHO) "Generating resource debug file: $(LOG_PATH)/$(PROJECT_NAME)_resource_debug.txt";                     \
          $(GAWK) --re-interval -v DEBUG=1 -f fetch-memory-info.awk $(LST_LIST)                                         \
              > $(LOG_PATH)/$(PROJECT_NAME)_resource_debug.txt;                                                         \
      fi;                                                                                                               \
    else                                                                                                                \
        $(ECHO) "Error: GAWK not installed properly. Please update MAKESUPPORT to latest version.";                     \
    fi;                                                                                                                 \
 fi;                                                                                                                    \
 $(RM) fetch-memory-info-meta.txt;                                                                                      \
 $(RM) fetch-memory-info.awk;

endif
#-----------------------------------------------------------------------------
# Size-Rule to generate gsize-output for all Objects.
# Output is also stored in a txt-file in the log-path
#-----------------------------------------------------------------------------
size-all: ;
	@if [ -f != $(OBJ_PATH)/*.* ] ; then            \
            $(ECHO)"No Object-Files exist to generate SIZE_OUTPUT, please build project or single FILE first";          \
        else                                                                                                            \
            $(foreach obj,$(OBJ_PATH)/*.$(OBJ_SUFFIX),$(GSIZE) $(obj)) &&                                               \
            $(foreach obj,$(OBJ_PATH)/*.$(OBJ_SUFFIX),$(GSIZE) $(obj)) > GSIZE_ALL_OBJECTS.txt;                         \
            $(MV) GSIZE_ALL_OBJECTS.txt $(LOG_PATH)/GSIZE_ALL_OBJECTS.txt;                                              \
        fi;

#-----------------------------------------------------------------------------
# Size-Rule to generate Single-Object-File gsize-output.
# Output is also stored in a txt-file in the log-path
#-----------------------------------------------------------------------------
size-%.$(OBJ_SUFFIX): ;
	@if [ -f $(OBJ_PATH)/$*.* ] ; then                                                                              \
          $(GSIZE) $(OBJ_PATH)/$(subst size-,,$@) &&                                                                    \
          $(GSIZE) $(OBJ_PATH)/$(subst size-,,$@) > GSIZE_$(subst size-,,$(subst .obj,,$@)).txt;                        \
          $(MV) GSIZE_$(subst size-,,$(subst .obj,,$@)).txt $(LOG_PATH)/GSIZE_$(subst size-,,$(subst .obj,,$@)).txt;    \
        else                                                                                                            \
          $(ECHO)"  $(OBJ_PATH)/$(subst size-,,$@) does not exists, please build file and retry";                       \
        fi;


##############################################################################
# Include section
##############################################################################

#-----------------------------------------------------------------------------
# generate dependencies automatically
#-----------------------------------------------------------------------------
-include $(PROJECT_NAME).dep

# end of Global.Makefile.target.make
